The method generates HTTP 404 errors only, but in the code it's used as a generic error handler. It would be better to pass the error code as an argument.