• Mayank Mittal's avatar
    Adds try-catch in all the scripts for safe app closing (#185) · 07fc74d2
    Mayank Mittal authored
    # Description
    
    Propogates the try-except-finally paradigm from the unit tests to all
    the scripts. This ensures a cleaner exit of the script and allows a
    better traceback print.
    
    ```python
    import traceback
    
    import carb
    
    if __name__ == "__main__":
        try:
            # Run the main function
            main()
        except Exception as err:
            carb.log_error(err)
            carb.log_error(traceback.format_exc())
            raise
        finally:
            # close sim app
            simulation_app.close()
    ```
    
    ## Type of change
    
    - New feature (non-breaking change which adds functionality)
    - This change requires a documentation update
    
    ## Checklist
    
    - [x] I have run the [`pre-commit` checks](https://pre-commit.com/) with
    `./orbit.sh --format`
    - [ ] I have made corresponding changes to the documentation
    - [x] My changes generate no new warnings
    - [ ] I have added tests that prove my fix is effective or that my
    feature works
    - [ ] I have updated the changelog and the corresponding version in the
    extension's `config/extension.toml` file
    07fc74d2
play.py 5.59 KB