Skip to content

Don't log 404s to console #12900

Answered by EskelCz
Dig-Doug asked this question in Q&A
Oct 28, 2024 · 2 comments · 2 replies
Discussion options

You must be logged in to vote

The only way I found is this:
hooks.server.js

export function handleError({ error }) {
  if (!error.message.includes('Not found')) { // Ignore 404 Not Found
    console.error(error.stack)
    return { message: 'Internal Error' }
  }
}

Replies: 2 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Answer selected by Dig-Doug
Comment options

You must be logged in to vote
2 replies
@Rich-Harris
Comment options

@Rich-Harris
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants