MCPcopy
hub / github.com/FredKSchott/snowpack / handleResponseError

Function handleResponseError

snowpack/src/commands/dev.ts:212–230  ·  view source on GitHub ↗
(req, res, err: Error | NotFoundError)

Source from the content-addressed store, hash-verified

210}
211
212function handleResponseError(req, res, err: Error | NotFoundError) {
213 if (err instanceof NotFoundError) {
214 // Don't log favicon "Not Found" errors. Browsers automatically request a favicon.ico file
215 // from the server, which creates annoying errors for new apps / first experiences.
216 if (req.url !== '/favicon.ico') {
217 logger.error(`[404] ${err.message}`);
218 }
219 sendResponseError(req, res, 404);
220 return;
221 }
222 console.log(err);
223 logger.error(err.toString());
224 logger.error(`[500] ${req.url}`, {
225 // @ts-ignore
226 name: err.__snowpackBuildDetails?.name,
227 });
228 sendResponseError(req, res, 500);
229 return;
230}
231
232function getServerRuntime(
233 sp: SnowpackDevServer,

Callers 1

handleRequestFunction · 0.85

Calls 3

sendResponseErrorFunction · 0.85
errorMethod · 0.80
logMethod · 0.80

Tested by

no test coverage detected