diff --git a/types/raven/index.d.ts b/types/raven/index.d.ts index d8dd7f9732..15a50ab884 100644 --- a/types/raven/index.d.ts +++ b/types/raven/index.d.ts @@ -9,91 +9,91 @@ import { IncomingMessage, ServerResponse } from 'http'; import { EventEmitter } from 'events'; declare namespace Raven { - const version: string; - function config(dsn: string | false, options?: ConstructorOptions): Client; - function wrap(func: () => void, onErr?: () => void): () => void; - function wrap(options: any, func: () => void, onErr?: () => void): () => void; - function interceptErr(ctx: any): Client; - function setContext(ctx: any): Client; - function captureException(e: Error, cb?: CaptureCallback): Client; - function captureException(e: Error, options?: CaptureOptions, cb?: CaptureCallback): Client; - function mergeContext(ctx: any): Client; - function getContext(): any; - function errorHandler(): (e: Error, req: IncomingMessage, res: ServerResponse, next: () => void) => void; - function context(ctx: any, func: () => void, onErr?: () => void): Client; - function context(func: () => void, onErr?: () => void): Client; - function captureBreadcrumb(breadcrumb: any): void; - function disableConsoleAlerts(): void; - function consoleAlert(msg: string): void; - function parseDSN(dsn: string | false): parsedDSN; + const version: string; + function config(dsn: string | false, options?: ConstructorOptions): Client; + function wrap(func: () => void, onErr?: () => void): () => void; + function wrap(options: any, func: () => void, onErr?: () => void): () => void; + function interceptErr(ctx: any): Client; + function setContext(ctx: any): Client; + function captureException(e: Error, cb?: CaptureCallback): Client; + function captureException(e: Error, options?: CaptureOptions, cb?: CaptureCallback): Client; + function mergeContext(ctx: any): Client; + function getContext(): any; + function errorHandler(): (e: Error, req: IncomingMessage, res: ServerResponse, next: () => void) => void; + function context(ctx: any, func: () => void, onErr?: () => void): Client; + function context(func: () => void, onErr?: () => void): Client; + function captureBreadcrumb(breadcrumb: any): void; + function disableConsoleAlerts(): void; + function consoleAlert(msg: string): void; + function parseDSN(dsn: string | false): parsedDSN; - class Client extends EventEmitter { - constructor(options: ConstructorOptions); - constructor(dsn: string, options?: ConstructorOptions); - config(dsn: string, options?: ConstructorOptions): Client; - install(options?: ConstructorOptions, cb?: () => void): Client; - setContext(ctx: any): Client; - requestHandler(): (req: IncomingMessage, res: ServerResponse, next: () => void) => void; - errorHandler(): (e: Error, req: IncomingMessage, res: ServerResponse, next: () => void) => void; - captureException(error: Error, cb?: CaptureCallback): void; - captureException(error: Error, options?: CaptureOptions, cb?: CaptureCallback): void; - captureMessage(message: string, cb?: CaptureCallback): void; - captureMessage(message: string, options?: CaptureOptions, cb?: CaptureCallback): void; - captureBreadcrumb(breadcrumb: any): void; - setUserContext(data: UserData): void; - setDataCallback(fn: DataCallback): void; - context(ctx: any, func: () => void, onErr?: () => void): Client; - context(func: () => void, onErr?: () => void): Client; - process(kwargs: any, cb?: () => void): void; - process(eventId: string, kwargs: any, cb?: () => void): void; - } + class Client extends EventEmitter { + constructor(options: ConstructorOptions); + constructor(dsn: string, options?: ConstructorOptions); + config(dsn: string, options?: ConstructorOptions): Client; + install(options?: ConstructorOptions, cb?: () => void): Client; + setContext(ctx: any): Client; + requestHandler(): (req: IncomingMessage, res: ServerResponse, next: () => void) => void; + errorHandler(): (e: Error, req: IncomingMessage, res: ServerResponse, next: () => void) => void; + captureException(error: Error, cb?: CaptureCallback): void; + captureException(error: Error, options?: CaptureOptions, cb?: CaptureCallback): void; + captureMessage(message: string, cb?: CaptureCallback): void; + captureMessage(message: string, options?: CaptureOptions, cb?: CaptureCallback): void; + captureBreadcrumb(breadcrumb: any): void; + setUserContext(data: UserData): void; + setDataCallback(fn: DataCallback): void; + context(ctx: any, func: () => void, onErr?: () => void): Client; + context(func: () => void, onErr?: () => void): Client; + process(kwargs: any, cb?: () => void): void; + process(eventId: string, kwargs: any, cb?: () => void): void; + } - interface ConstructorOptions { - name?: string; - logger?: string; - release?: string; - environment?: string; - tags?: { string: string }; - extra?: { string: any }; - dataCallback?: DataCallback; - transport?: () => void; - captureUnhandledRejections?: boolean; - autoBreadcrumbs?: boolean | object; - } + interface ConstructorOptions { + name?: string; + logger?: string; + release?: string; + environment?: string; + tags?: { string: string }; + extra?: { string: any }; + dataCallback?: DataCallback; + transport?: () => void; + captureUnhandledRejections?: boolean; + autoBreadcrumbs?: boolean | object; + } - interface UserData { - id: string; - handle?: string; - } + interface UserData { + id: string; + handle?: string; + } - interface parsedDSN { - protocol: string; - public_key: string; - private_key: string; - host: string; - path: string; - project_id: string; - port: number; - } + interface parsedDSN { + protocol: string; + public_key: string; + private_key: string; + host: string; + path: string; + project_id: string; + port: number; + } - interface CaptureCallback { - (err: { string: any }, eventId: any): void; - } + interface CaptureCallback { + (err: { string: any }, eventId: any): void; + } - interface DataCallback { - (data: { string: any }): void; - } + interface DataCallback { + (data: { string: any }): void; + } - interface TransportCallback { - (options: { string: any }): void; - } + interface TransportCallback { + (options: { string: any }): void; + } - interface CaptureOptions { - tags?: { string: string }; - extra?: { string: any }; - fingerprint?: string; - level?: string; - } + interface CaptureOptions { + tags?: { string: string }; + extra?: { string: any }; + fingerprint?: string; + level?: string; + } } export = Raven; diff --git a/types/raven/raven-tests.ts b/types/raven/raven-tests.ts index 6fa3d6e981..d4d5339e07 100644 --- a/types/raven/raven-tests.ts +++ b/types/raven/raven-tests.ts @@ -5,24 +5,24 @@ const dsn = '___DSN___'; const client = Raven.config(dsn, { autoBreadcrumbs: true }).install(); Raven.config(dsn).install({ captureUnhandledRejections: true }); client.setContext({}); -client.on('logged', () => {}); +client.on('logged', () => { }); client.process({}); -client.captureMessage('Broken!', (err, eventId) => {}); +client.captureMessage('Broken!', (err, eventId) => { }); new Raven.Client({ name: 'YAY!' }); new Raven.Client(dsn, { name: 'YAY!' }); new Raven.Client(dsn); try { - throw new Error(); + throw new Error(); } catch (e) { - var eventId = Raven.captureException(e, (sendErr, eventId) => {}); + var eventId = Raven.captureException(e, (sendErr, eventId) => { }); } Raven.setContext({}); Raven.mergeContext({}); Raven.context(() => { - Raven.captureBreadcrumb({}); + Raven.captureBreadcrumb({}); }); -var doIt = () => {} +var doIt = () => { } setTimeout(Raven.wrap(doIt), 1000) Raven.parseDSN('https://8769c40cf49c4cc58b51fa45d8e2d166:296768aa91084e17b5ac02d3ad5bc7e7@app.getsentry.com/269')