Panic handling does not log reason for script being halted (#334)

This commit is contained in:
Frederik Ring 2024-01-26 20:02:09 +01:00 committed by GitHub
parent 810c8871ec
commit ed5abd5ba8
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -21,6 +21,9 @@ func main() {
defer func() { defer func() {
if pArg := recover(); pArg != nil { if pArg := recover(); pArg != nil {
if err, ok := pArg.(error); ok { if err, ok := pArg.(error); ok {
s.logger.Error(
fmt.Sprintf("Executing the script encountered a panic: %v", err),
)
if hookErr := s.runHooks(err); hookErr != nil { if hookErr := s.runHooks(err); hookErr != nil {
s.logger.Error( s.logger.Error(
fmt.Sprintf("An error occurred calling the registered hooks: %s", hookErr), fmt.Sprintf("An error occurred calling the registered hooks: %s", hookErr),