fix: make sure all logged errors are preceeded with a message
Just logging an error makes it difficult to relate the error log to code in the codebase. Error logging a message right before the error itself makes it easier to search the codebase for that error log.
This commit is contained in:
@@ -35,6 +35,7 @@ export default async function CurrentPreviewPage({
|
||||
return <ContentPage data={response.data} />
|
||||
} catch (error) {
|
||||
// TODO: throw 500
|
||||
console.error("Error in current preview page")
|
||||
console.error(error)
|
||||
throw new Error("Something went wrong")
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ export async function POST(request: NextRequest) {
|
||||
|
||||
return Response.json({ revalidated: true, now: Date.now() })
|
||||
} catch (error) {
|
||||
console.info("Failed to revalidate tag(s)")
|
||||
console.error("Failed to revalidate tag(s)")
|
||||
console.error(error)
|
||||
return internalServerError({ revalidated: false, now: Date.now() })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user