Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Enhancement] Improve Error Handling in ./init.sh Script #46

Open
Vaibhav701161 opened this issue Mar 7, 2025 · 0 comments · May be fixed by #47
Open

[Enhancement] Improve Error Handling in ./init.sh Script #46

Vaibhav701161 opened this issue Mar 7, 2025 · 0 comments · May be fixed by #47

Comments

@Vaibhav701161
Copy link

Issue Summary

The ./init.sh script, which initializes the cBioPortal Docker setup, lacks strict error handling. When a sub-script or command fails, the script continues execution silently, making it difficult for users to diagnose issues—especially on non-Linux systems. Improving error handling will enhance reliability and provide better feedback to contributors.

Problem Description

  • The script orchestrates multiple sub-scripts responsible for setting up dependencies, environment variables, and databases.
  • If a sub-script fails, the failure is not always surfaced due to missing error checks, causing the setup to appear successful while being incomplete.
  • This issue is more prominent on Windows/macOS, where certain shell commands behave differently, leading to hidden failures.
  • Logs do not always provide clear error messages, making debugging difficult.

Proposed Solution

To improve the robustness of the ./init.sh script, I propose the following changes:

  1. Fail Fast on Errors

    • Enforce strict error handling using set -e to terminate the script when any command fails.
    • Use trap to capture errors and print meaningful messages before exiting.
  2. Improve Logging and Debugging

    • Implement set -x as an optional debug mode to display executed commands.
    • Add clearer error messages to guide users when failures occur.
  3. Cross-Platform Compatibility Enhancements

    • Identify problematic shell commands that may behave inconsistently across different platforms.
    • Replace or document environment-specific dependencies for better cross-OS support.
  4. Enhance Documentation

    • Update the documentation to include common troubleshooting steps and error-handling mechanisms.

Steps to Reproduce the Issue

  1. Clone the cbioportal-docker-compose repository and follow the setup instructions.
  2. Run ./init.sh on a non-Linux system (e.g., Windows WSL or macOS).
  3. Observe that certain failures occur silently, leading to an incomplete setup.

Expected Behavior

  • The script should halt immediately when an error occurs.
  • The failure reason should be clearly logged.
  • Contributors should be able to diagnose and fix issues more efficiently.

Additional Context

  • This issue is particularly relevant for new contributors who may struggle with silent failures.
  • Improving error handling will make onboarding smoother and debugging easier.
  • Happy to work on this and submit a PR!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant