We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Using aah v0.12.3
I'm creating a new api project with aah new I've found an issue when i try to create centralized error handler by creating AppErrorHandler function and register it in init.go by following the instruction from https://docs.aahframework.org/v0.12/error-handling.html#registering-centralized-error-handler
aah new
AppErrorHandler
init.go
func AppErrorHandler(ctx *aah.Context, err *aah.Error) bool { switch err.Code { case 400: // handle bad request case 401: // handle unauthenticated request case 403: // handle permission issues case 500: // handle internal server issues } return true }
func init() { app := aah.App() app.SetErrorHandler(AppErrorHandler) }
an error occurred when i run it with aah run :
aah run
panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x0 pc=0x8a7974]
goroutine 1 [running]: aahframe%2ework.(*errorManager).SetHandler(0x0, 0xa29780) /home/user1/go/pkg/mod/aahframe.work@v0.12.3/error.go:132 +0x34 aahframe%2ework.(*Application).SetErrorHandler(0xc0001e21c0, 0xa29780) /home/user1/go/pkg/mod/aahframe.work@v0.12.3/aah.go:400 +0x3c main.init.0() /home/user1/ws_aah/aah-app/app/init.go:43 +0x118 FATAL aah application did not start
Thanks
The text was updated successfully, but these errors were encountered:
@arpodungge It seems I need to update the documentation. Please use OnStart event, update your code to
OnStart
app := aah.App() app.OnStart(func(e *aah.Event) { app.SetErrorHandler(AppErrorHandler) })
Sorry, something went wrong.
I'm closing this one. Please let me know.
fix doc on SetErrorHandler
f62cb2c
See discussion at go-aah/aah#261.
jeevatkm
No branches or pull requests
Using aah v0.12.3
I'm creating a new api project with
aah new
I've found an issue when i try to create centralized error handler by creating
AppErrorHandler
function and register it ininit.go
by following the instruction fromhttps://docs.aahframework.org/v0.12/error-handling.html#registering-centralized-error-handler
an error occurred when i run it with
aah run
:Thanks
The text was updated successfully, but these errors were encountered: