2

How to handle different error codes on app engine? In my app.yaml file, I have-

error_handlers:
  - file: error/notfound.html

  - error_code: over_quota
    file: error/over_quota.html

handlers:
..some handlers..

This doesn't seem to work. If my site doesn't have a folder name foo and a user looks for http://mysite.com/foo, it just returns a standard 404 error, not the page I specified on app.yaml.

My static dir is separate from error dir. Both error and static dirs are inside project dir. What am I missing?

Is there a way to show custom page rather than a custom response message?

Malakai
  • 81
  • 1
  • 10
  • 3
    Possible duplicate of [Google App Engine and 404 error](https://stackoverflow.com/questions/189751/google-app-engine-and-404-error) – Gabriel H. Nunes Feb 16 '19 at 13:30

1 Answers1

2

The 404 error handler page will only be displayed if a URL fails to match any patterns in app.yaml. If your app is returning a 404, it's up to the app to display the error page you want - there's no way to tell the framework to display the default error page instead.

Nick Johnson
  • 100,655
  • 16
  • 128
  • 198
  • How you would do it from the py script? Is there a way to determine the different codes and depending on the code to take appropriate actions like displaying an error page? – Malakai Jul 21 '11 at 13:56
  • @WebApp That depends entirely on the framework, which you haven't specified. In webapp, for instance, you can define your own error() method on handlers to output a custom 500 page, and you can define a catchall handler to print 404s. – Nick Johnson Jul 22 '11 at 00:04