File tree Expand file tree Collapse file tree 2 files changed +9
-14
lines changed
Expand file tree Collapse file tree 2 files changed +9
-14
lines changed Original file line number Diff line number Diff line change @@ -97,16 +97,13 @@ export class DbgpConnection extends EventEmitter {
9797 // call response handler
9898 const xml = iconv . decode ( response , ENCODING )
9999 const parser = new DOMParser ( {
100- errorHandler : {
101- warning : warning => {
102- this . emit ( 'warning' , warning )
103- } ,
104- error : error => {
105- this . emit ( 'error' , error instanceof Error ? error : new Error ( error as string ) )
106- } ,
107- fatalError : error => {
108- this . emit ( 'error' , error instanceof Error ? error : new Error ( error as string ) )
109- } ,
100+ onError : ( level , msg ) => {
101+ if ( level === 'warning' ) {
102+ this . emit ( 'warning' , msg )
103+ }
104+ if ( level === 'error' || level === 'fatalError' ) {
105+ this . emit ( 'error' , new Error ( msg ) )
106+ }
110107 } ,
111108 } )
112109 this . emit ( 'log' , `-> ${ xml . replace ( / [ \0 \n ] / g, '' ) } ` )
Original file line number Diff line number Diff line change @@ -155,10 +155,8 @@ export class ProxyConnect extends EventEmitter {
155155 /** Parse data from response server and emit the relevant notification. */
156156 private _responseStrategy ( data : Buffer ) {
157157 try {
158- const documentElement = this . _parser . parseFromString (
159- decode ( data , ENCODING ) ,
160- 'application/xml'
161- ) . documentElement
158+ const documentElement = this . _parser . parseFromString ( decode ( data , ENCODING ) , 'application/xml' )
159+ . documentElement !
162160 const isSuccessful = documentElement . getAttribute ( 'success' ) === '1'
163161 const error = documentElement . firstChild
164162 if ( isSuccessful && documentElement . nodeName === 'proxyinit' ) {
You can’t perform that action at this time.
0 commit comments