diff --git a/src/lib/api.ts b/src/lib/api.ts index e407107ed..71fe4e734 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -433,7 +433,11 @@ export async function getSpaceCustomization(spaceId: string): Promise>(extend); return { ...raw, ...parsed }; } catch (error) { - console.error('Failed to parse x-gitbook-customization header (ignored)', error); + console.error( + `Failed to parse x-gitbook-customization header (ignored): ${ + (error as Error).stack ?? (error as Error).message ?? error + }`, + ); } } diff --git a/src/lib/async.ts b/src/lib/async.ts index f58ea547d..eefc98d76 100644 --- a/src/lib/async.ts +++ b/src/lib/async.ts @@ -208,7 +208,7 @@ function logIgnoredError(message: string, error: Error) { return; } - console.error(message, error); + console.error(`${message}: ${error.stack ?? error.message ?? error}`); } const UndefinedSymbol = Symbol('Undefined'); diff --git a/src/lib/images.ts b/src/lib/images.ts index 2f65f0b18..6bf6ba7cd 100644 --- a/src/lib/images.ts +++ b/src/lib/images.ts @@ -108,7 +108,11 @@ export async function getImageSize( height: json.original.height, }; } catch (error) { - console.error(`failed to fetch image size for ${input}`, error); + console.error( + `failed to fetch image size for ${input}: ${ + (error as Error).stack ?? (error as Error).message ?? error + }`, + ); return null; } }