| 1038 | } |
| 1039 | |
| 1040 | function notFound (reply) { |
| 1041 | if (reply[kRouteContext][kFourOhFourContext] === null) { |
| 1042 | reply.log.warn('Trying to send a NotFound error inside a 404 handler. Sending basic 404 response.') |
| 1043 | reply.code(404).send('404 Not Found') |
| 1044 | return |
| 1045 | } |
| 1046 | |
| 1047 | reply.request[kRouteContext] = reply[kRouteContext][kFourOhFourContext] |
| 1048 | |
| 1049 | // preHandler hook |
| 1050 | if (reply[kRouteContext].preHandler !== null) { |
| 1051 | preHandlerHookRunner( |
| 1052 | reply[kRouteContext].preHandler, |
| 1053 | reply.request, |
| 1054 | reply, |
| 1055 | internals.preHandlerCallback |
| 1056 | ) |
| 1057 | } else { |
| 1058 | internals.preHandlerCallback(null, reply.request, reply) |
| 1059 | } |
| 1060 | } |
| 1061 | |
| 1062 | /** |
| 1063 | * This function runs when a payload that is not a string|buffer|stream or null |