MCPcopy Create free account
hub / github.com/effect-app/libs / causePrettyMessage

Function causePrettyMessage

repos/effect/packages/effect/src/internal/effect.ts:380–395  ·  view source on GitHub ↗
(u: Record<string, unknown> | Error)

Source from the content-addressed store, hash-verified

378 }
379 }
380 } else {
381 error = new globalThis.Error(
382 !original ? `Unknown error: ${original}` : kind === "string" ? original as any : formatJson(original)
383 )
384 }
385 return error
386}
387
388const causePrettyMessage = (u: Record<string, unknown> | Error): string => {
389 if (typeof u.message === "string") {
390 return u.message
391 } else if (
392 typeof u.toString === "function"
393 && u.toString !== Object.prototype.toString
394 && u.toString !== Array.prototype.toString
395 ) {
396 try {
397 return u.toString()
398 } catch {

Callers 1

causePrettyErrorFunction · 0.85

Calls 2

formatJsonFunction · 0.90
toStringMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…