abogoyavlensky / automigrate

:robot: Auto-generated database migrations for Clojure
https://cljdoc.org/d/net.clojars.abogoyavlensky/automigrate
MIT License
77 stars 1 forks source link

Need Notification/Stopping Mechanism for CI Errors #96

Open yyna opened 1 month ago

yyna commented 1 month ago

Hello,

I’m facing an issue with error handling in the CI process. Currently, when an error occurs, I would like to receive notifications or halt the deployment process. However, it seems that all errors are being thrown and then caught, which prevents the exit code from being returned properly.

Could you please advise on how to ensure that the exit code is received in order to trigger notifications or stop the deployment when an error occurs?

bakyeono commented 1 month ago

Does the throw-error? option make sense here?

(defn migrate
  "Run migration on a db."
  [{:keys [... throw-error?]
    :or {...
         throw-error? false}}]
abogoyavlensky commented 1 month ago

@yyna Hi, thank you so much for the issue!

Could you please advise on how to ensure that the exit code is received in order to trigger notifications or stop the deployment when an error occurs?

That’s a great point. Currently, all errors are caught, and the tool prints a message without a proper exit code. I think this could be improved in the context of this issue.

@bakyeono Hi, the throw-error? option makes sense, but I would consider extending the tool’s config as a last resort. First, I would try to properly return the exit code when an error occurs always, along with a text message, instead of ignoring it.