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:
@@ -102,7 +102,7 @@ async function getLanguageSwitcher(options: LanguageSwitcherVariables) {
|
||||
},
|
||||
])
|
||||
default:
|
||||
console.info(`type: [${options.contentType}]`)
|
||||
console.error(`type: [${options.contentType}]`)
|
||||
console.error(`Trying to get a content type that is not supported`)
|
||||
throw internalServerError()
|
||||
}
|
||||
@@ -136,7 +136,7 @@ export const languageSwitcherQueryRouter = router({
|
||||
validateLanguageSwitcherData.safeParse(urls)
|
||||
|
||||
if (!validatedLanguageSwitcherData.success) {
|
||||
console.info(
|
||||
console.error(
|
||||
`Failed to validate Language Switcher Data - (contentType: ${ctx.contentType}, lang: ${ctx.lang}, uid: ${ctx.uid})`
|
||||
)
|
||||
console.error(validatedLanguageSwitcherData.error)
|
||||
|
||||
Reference in New Issue
Block a user