MCPcopy Create free account
hub / github.com/contentlayerdev/contentlayer / errorToString

Function errorToString

packages/@contentlayer/utils/src/index.ts:69–76  ·  view source on GitHub ↗
(error: any)

Source from the content-addressed store, hash-verified

67 !guard(el)
68
69export const errorToString = (error: any) => {
70 const stack = process.env.CL_DEBUG ? error.stack : undefined
71 const str = error.toString()
72 const stackStr = stack ? `\n${stack}` : ''
73 if (str !== '[object Object]') return str + stackStr
74
75 return JSON.stringify({ ...error, stack }, null, 2)
76}
77
78export const capitalizeFirstLetter = (str: string): string => str.charAt(0).toUpperCase() + str.slice(1)
79

Callers 15

ImageErrorClass · 0.90
ComputedValueErrorClass · 0.90
UnexpectedErrorClass · 0.90
ConfigReadErrorClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…