MCPcopy
hub / github.com/slackapi/node-slack-sdk / errorWithCode

Function errorWithCode

packages/rtm-api/src/errors.ts:54–59  ·  view source on GitHub ↗

* Factory for producing a CodedError from a generic error

(error: Error, code: ErrorCode)

Source from the content-addressed store, hash-verified

52 * Factory for producing a {@link CodedError} from a generic error
53 */
54function errorWithCode(error: Error, code: ErrorCode): CodedError {
55 // NOTE: might be able to return something more specific than a CodedError with conditional typing
56 const codedError = error as Partial<CodedError>;
57 codedError.code = code;
58 return codedError as CodedError;
59}
60
61 /**
62 * A factory to create RTMWebsocketError objects.

Callers 5

platformErrorFromEventFunction · 0.70
noReplyReceivedErrorFunction · 0.70
sendWhileNotReadyErrorFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected