@@ -19,9 +19,6 @@ import { HTTPSTransport, HTTPTransport } from './transports';
1919 * @see NodeClient for more information.
2020 */
2121export interface NodeOptions extends Options {
22- /** Callback that is executed when a fatal global error occurs. */
23- onFatalError ?( error : Error ) : void ;
24-
2522 /** Sets an optional server name (device name) */
2623 serverName ?: string ;
2724
@@ -39,6 +36,9 @@ export interface NodeOptions extends Options {
3936
4037 /** Sets the number of context lines for each frame when loading a file. */
4138 frameContextLines ?: number ;
39+
40+ /** Callback that is executed when a fatal global error occurs. */
41+ onFatalError ?( error : Error ) : void ;
4242}
4343
4444/**
@@ -49,35 +49,9 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
4949 /**
5050 * @inheritDoc
5151 */
52- protected _setupTransport ( ) : Transport {
53- if ( ! this . _options . dsn ) {
54- // We return the noop transport here in case there is no Dsn.
55- return super . _setupTransport ( ) ;
56- }
57-
58- const dsn = new Dsn ( this . _options . dsn ) ;
59-
60- const transportOptions : TransportOptions = {
61- ...this . _options . transportOptions ,
62- ...( this . _options . httpProxy && { httpProxy : this . _options . httpProxy } ) ,
63- ...( this . _options . httpsProxy && { httpsProxy : this . _options . httpsProxy } ) ,
64- ...( this . _options . caCerts && { caCerts : this . _options . caCerts } ) ,
65- dsn : this . _options . dsn ,
66- } ;
67-
68- if ( this . _options . transport ) {
69- return new this . _options . transport ( transportOptions ) ;
70- }
71- if ( dsn . protocol === 'http' ) {
72- return new HTTPTransport ( transportOptions ) ;
73- }
74- return new HTTPSTransport ( transportOptions ) ;
75- }
76-
77- /**
78- * @inheritDoc
79- */
52+ // eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/explicit-module-boundary-types
8053 public eventFromException ( exception : any , hint ?: EventHint ) : PromiseLike < Event > {
54+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
8155 let ex : any = exception ;
8256 const mechanism : Mechanism = {
8357 handled : true ,
@@ -91,7 +65,7 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
9165 const message = `Non-Error exception captured with keys: ${ extractExceptionKeysForMessage ( exception ) } ` ;
9266
9367 getCurrentHub ( ) . configureScope ( scope => {
94- scope . setExtra ( '__serialized__' , normalizeToSize ( exception as { } ) ) ;
68+ scope . setExtra ( '__serialized__' , normalizeToSize ( exception as Record < string , unknown > ) ) ;
9569 } ) ;
9670
9771 ex = ( hint && hint . syntheticException ) || new Error ( message ) ;
@@ -147,4 +121,32 @@ export class NodeBackend extends BaseBackend<NodeOptions> {
147121 }
148122 } ) ;
149123 }
124+
125+ /**
126+ * @inheritDoc
127+ */
128+ protected _setupTransport ( ) : Transport {
129+ if ( ! this . _options . dsn ) {
130+ // We return the noop transport here in case there is no Dsn.
131+ return super . _setupTransport ( ) ;
132+ }
133+
134+ const dsn = new Dsn ( this . _options . dsn ) ;
135+
136+ const transportOptions : TransportOptions = {
137+ ...this . _options . transportOptions ,
138+ ...( this . _options . httpProxy && { httpProxy : this . _options . httpProxy } ) ,
139+ ...( this . _options . httpsProxy && { httpsProxy : this . _options . httpsProxy } ) ,
140+ ...( this . _options . caCerts && { caCerts : this . _options . caCerts } ) ,
141+ dsn : this . _options . dsn ,
142+ } ;
143+
144+ if ( this . _options . transport ) {
145+ return new this . _options . transport ( transportOptions ) ;
146+ }
147+ if ( dsn . protocol === 'http' ) {
148+ return new HTTPTransport ( transportOptions ) ;
149+ }
150+ return new HTTPSTransport ( transportOptions ) ;
151+ }
150152}
0 commit comments