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

Could Magellan throw this error instead of printing it? #29

Open
vvvvalvalval opened this issue May 1, 2024 · 0 comments
Open

Could Magellan throw this error instead of printing it? #29

vvvvalvalval opened this issue May 1, 2024 · 0 comments

Comments

@vvvvalvalval
Copy link
Contributor

Hi @lambdatronic, it just took me quite some effort to trace an error to https://github.com/sig-gis/magellan/blob/main/src/magellan/core.clj#L193 due to the loss of information in this (println "Cannot write raster. Exception:" (class e)).

Arguably, the Clojure best practice is to propagate and/or enrich exceptions rather than stopping them and printing a reduced version of them, not only to ease this sort of investigation, but also to some that programs fail early rather than continue down an incorrect execution path. Do you agree this would be an improvement? I would suggest something like:

         (catch Exception e
           (throw (ex-info (str "Cannot write raster. Exception:" (class e))
                           {::filename filename
                            ::raster   raster}
                           e)))

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant