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

Function reportError

packages/vue/src/errorReporter.ts:18–53  ·  view source on GitHub ↗
(name: string)

Source from the content-addressed store, hash-verified

16}
17
18export function reportError(name: string) {
19 return Effect.fnUntraced(
20 function*(
21 cause: Cause.Cause<unknown>,
22 extras?: Record<string, unknown>,
23 level: LogLevel.Severity = "Error"
24 ) {
25 if (Cause.hasInterruptsOnly(cause)) {
26 yield* Effect.logDebug("Interrupted").pipe(Effect.annotateLogs("extras", JSON.stringify(extras ?? {})))
27 return Cause.squash(cause)
28 }
29
30 const error = tryCauseException(cause, name)
31 yield* reportSentry(error, extras, LogLevelToSentry(level))
32 yield* Effect
33 .logWithLevel(level)("Reporting error", cause)
34 .pipe(
35 Effect.annotateLogs(dropUndefined({
36 extras,
37 error: tryToReport(error),
38 cause: tryToJson(cause),
39 __error_name__: name
40 })),
41 Effect.catchCause((cause) => Effect.logWarning("Failed to log error", cause)),
42 Effect.catchCause(() => Effect.logFatal("Failed to log error cause"))
43 )
44
45 return error
46 },
47 (effect) =>
48 Effect.tapCause(effect, (cause) =>
49 Effect.logError("Failed to report error", cause).pipe(
50 Effect.tapCause(() => Effect.logFatal("Failed to log error cause"))
51 ))
52 )
53}
54
55function reportSentry(
56 error: CauseException<unknown>,

Callers 1

lib.tsFile · 0.90

Calls 7

LogLevelToSentryFunction · 0.90
dropUndefinedFunction · 0.90
tryToReportFunction · 0.90
tryToJsonFunction · 0.90
tryCauseExceptionFunction · 0.70
reportSentryFunction · 0.70
pipeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…