UNPKG

2.12 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Event } from '@sentry/types';
3import * as http from 'http';
4/**
5 * Express compatible tracing handler.
6 * @see Exposed as `Handlers.tracingHandler`
7 */
8export declare function tracingHandler(): (req: http.IncomingMessage, res: http.ServerResponse, next: (error?: any) => void) => void;
9declare type TransactionTypes = 'path' | 'methodPath' | 'handler';
10/**
11 * Enriches passed event with request data.
12 *
13 *
14 * @param event Will be mutated and enriched with req data
15 * @param req Request object
16 * @param options object containing flags to enable functionality
17 * @hidden
18 */
19export declare function parseRequest(event: Event, req: {
20 [key: string]: any;
21}, options?: {
22 request?: boolean | string[];
23 serverName?: boolean;
24 transaction?: boolean | TransactionTypes;
25 user?: boolean | string[];
26 version?: boolean;
27}): Event;
28/**
29 * Express compatible request handler.
30 * @see Exposed as `Handlers.requestHandler`
31 */
32export declare function requestHandler(options?: {
33 request?: boolean;
34 serverName?: boolean;
35 transaction?: boolean | TransactionTypes;
36 user?: boolean | string[];
37 version?: boolean;
38 flushTimeout?: number;
39}): (req: http.IncomingMessage, res: http.ServerResponse, next: (error?: any) => void) => void;
40/** JSDoc */
41interface MiddlewareError extends Error {
42 status?: number | string;
43 statusCode?: number | string;
44 status_code?: number | string;
45 output?: {
46 statusCode?: number | string;
47 };
48}
49/**
50 * Express compatible error handler.
51 * @see Exposed as `Handlers.errorHandler`
52 */
53export declare function errorHandler(options?: {
54 /**
55 * Callback method deciding whether error should be captured and sent to Sentry
56 * @param error Captured middleware error
57 */
58 shouldHandleError?(error: MiddlewareError): boolean;
59}): (error: MiddlewareError, req: http.IncomingMessage, res: http.ServerResponse, next: (error: MiddlewareError) => void) => void;
60/**
61 * @hidden
62 */
63export declare function logAndExitProcess(error: Error): void;
64export {};
65//# sourceMappingURL=handlers.d.ts.map
\No newline at end of file