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:
@@ -68,6 +68,7 @@ export async function request<T>(
|
||||
|
||||
return { data: response }
|
||||
} catch (error) {
|
||||
console.error("Error in graphql request")
|
||||
console.error(error)
|
||||
throw new Error("Something went wrong")
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ export async function batchRequest<T>(
|
||||
|
||||
return { data }
|
||||
} catch (error) {
|
||||
console.error("Error in batched graphql request")
|
||||
console.error(error)
|
||||
throw new Error("Something went wrong")
|
||||
}
|
||||
|
||||
@@ -35,6 +35,7 @@ export async function previewRequest<T>(
|
||||
|
||||
return { data: response }
|
||||
} catch (error) {
|
||||
console.error("Error in preview graphql request")
|
||||
console.error(error)
|
||||
throw new Error("Something went wrong")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user