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

invalid memory address or nil pointer dereference when registering centralized error handler #261

arpodungge opened this issue Jul 30, 2019 · 1 comment


Copy link

commented Jul 30, 2019

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

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()

an error occurred when i run it with 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/ +0x34
aahframe%2ework.(*Application).SetErrorHandler(0xc0001e21c0, 0xa29780)
/home/user1/go/pkg/mod/ +0x3c
/home/user1/ws_aah/aah-app/app/init.go:43 +0x118
FATAL aah application did not start


@jeevatkm jeevatkm self-assigned this Jul 31, 2019

@jeevatkm jeevatkm added the support label Jul 31, 2019


This comment has been minimized.

Copy link

commented Jul 31, 2019

@arpodungge It seems I need to update the documentation. Please use OnStart event, update your code to

app := aah.App()
app.OnStart(func(e *aah.Event) {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
2 participants
You can’t perform that action at this time.