Hide ppr rethrow console messages
This commit is contained in:
parent
45d3ba661f
commit
dbe410384e
@ -2,14 +2,19 @@ export const screenForPPR = <T>(
|
||||
error: any,
|
||||
fallback: T,
|
||||
sourceToLog?: string,
|
||||
debug?: boolean
|
||||
): T => {
|
||||
// PPR errors, if caught, must be re-thrown in order to
|
||||
// postpone rendering
|
||||
if (error.sourceError?.message?.includes('ppr-caught-error')) {
|
||||
console.log(`${sourceToLog}: throwing error.sourceError`);
|
||||
if (debug) {
|
||||
console.log(`${sourceToLog}: throwing error.sourceError`);
|
||||
}
|
||||
throw error.sourceError;
|
||||
} else if (error.message?.includes('ppr-caught-error')) {
|
||||
console.log(`${sourceToLog}: throwing error`);
|
||||
if (debug) {
|
||||
console.log(`${sourceToLog}: throwing error`);
|
||||
}
|
||||
throw error;
|
||||
}
|
||||
return fallback;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user