Skip to content
GitHub

CallHandler

interface in meocord/interface Since 4.1.0

interface CallHandler

Runs the rest of a call from inside an interceptor: the next interceptor, then the handler.

Members

handle

handle(): Promise<unknown>

Continues the call. Call it at most once: each call runs the rest of the pipeline, and the handler, again. Return or await what it returns to act on the result. When the interceptor returns first and leaves the promise, or a then or finally chain from it, without a rejection handler, the call ends when the handler does and fails with what it throws, so its filters see it. A promise it hands to something else, such as Promise.all, is that one's to handle. A run the interceptor takes on and returns before, as racing it against a timeout does, that later fails is logged as a warning, unless a handler of the interceptor's own disposes of the error. One that forwards it into a promise that has already settled, such as with (error) => reject(error), disposes of it unseen: race it with Promise.race, or handle the error where it arrives.

Returns

Promise<unknown>

What the handler returns, once it has run. Rejects with what the handler throws.

See also