MCPcopy Index your code
hub / github.com/monkeytypegame/monkeytype / getErrorMessage

Function getErrorMessage

backend/src/utils/error.ts:25–48  ·  view source on GitHub ↗
(error: unknown)

Source from the content-addressed store, hash-verified

23}
24
25export function getErrorMessage(error: unknown): string | undefined {
26 let message = "";
27
28 if (error instanceof Error) {
29 message = error.message;
30 } else if (
31 error !== null &&
32 typeof error === "object" &&
33 "message" in error &&
34 (typeof error.message === "string" || typeof error.message === "number")
35 ) {
36 message = `${error.message}`;
37 } else if (typeof error === "string") {
38 message = error;
39 } else if (typeof error === "number") {
40 message = `${error}`;
41 }
42
43 if (message === "") {
44 return undefined;
45 }
46
47 return message;
48}
49
50class MonkeyError extends Error implements MonkeyServerErrorType {
51 status: number;

Callers 11

bootServerFunction · 0.90
connectFunction · 0.90
connectFunction · 0.90
getLiveConfigurationFunction · 0.90
pushConfigurationFunction · 0.90
patchConfigurationFunction · 0.90
initFunction · 0.90
sendEmailFunction · 0.90
errorHandlingMiddlewareFunction · 0.90
handleReportsFunction · 0.90
sendVerificationEmailFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected