ghdl
ghdl copied to clipboard
Refactor file download error handling
Description
This PR refactors the error handling in the file download process to provide a more robust and flexible error handling mechanism.
Summary of Changes
- In
dl.go
:- Replaced the panic statement in the
DlTo
method of theGHReleaseDl
struct with an error return. This ensures that errors during the file download process are returned to the caller function instead of abruptly stopping the program execution.
- Replaced the panic statement in the
- In
ghdl/main.go
:- Updated the
Run
function of therootCmd
variable to handle the error returned by theDlTo
method. If an error is returned, an error message is printed and the program exits with a non-zero status code.
- Updated the
These changes improve the code's reliability and maintainability by providing a more controlled and predictable error handling mechanism.
Fixes #3.
To checkout this PR branch, run the following command in your terminal:
git checkout sweep/refactor-file-download-error-handling
To get Sweep to edit this pull request, leave a comment below or in the code. Leaving a comment in the code will only modify the file but commenting below can change the entire PR.
Also refactor this commit: sweep: https://github.com/beetcb/ghdl/commit/1f17aa96e33c912de7557612df3e628d5f91ebaf