juno
juno copied to clipboard
Remove Panics of the app
Describe the bug Each time the app encounters an error that we should not recover, instead of Panic, and printing all the stack traces, we should handle that error, print an Error log, and close properly the app.
There should not exist panic,
As per as #264 it would be nice to extend a config env variable (eg. juno_env="prod") so zap dpanic can be used. Panic behaviour is different whether the logger is initiated with a "development" or a "production" setting. Documentation says:
DPanic stands for "panic in development." In development, it logs at PanicLevel; otherwise, it logs at ErrorLevel. DPanic makes it easier to catch errors that are theoretically possible, but shouldn't actually happen, without crashing in production.
This would highly improve logging. Dpanic would then be used where panic might be needed (mainly at bootstrap) and enforce some rules in the CI/CD making sure that panic() is not being used.
That sounds great! if you want to take a look at that is more than welcome!
Alright! I'll get on with it then!