@@ -105,13 +105,9 @@ class HttpsResponseLegacy implements IHttpsResponseLegacy {
105105 // cache it because asking it again wont work as the socket is closed
106106 stringResponse : string ;
107107 toString ( ) {
108- try {
109- // TODO: handle arraybuffer already stored
110- this . stringResponse = this . stringResponse || this . response . asString ( ) ;
111- return this . stringResponse ;
112- } catch {
113- return null ;
114- }
108+ // TODO: handle arraybuffer already stored
109+ this . stringResponse = this . stringResponse || this . response . asString ( ) ;
110+ return this . stringResponse ;
115111 }
116112 async toStringAsync ( ) : Promise < string > {
117113 if ( this . stringResponse ) {
@@ -128,18 +124,13 @@ class HttpsResponseLegacy implements IHttpsResponseLegacy {
128124 // cache it because asking it again wont work as the socket is closed
129125 jsonResponse : any ;
130126 toJSON ( encoding ?: HttpResponseEncoding ) {
131- try {
132- if ( this . jsonResponse !== undefined ) {
133- return this . jsonResponse ;
134- }
135- // TODO: handle arraybuffer already stored
136- this . stringResponse = this . stringResponse || this . response . asString ( ) ;
137- this . jsonResponse = this . stringResponse ? parseJSON ( this . stringResponse ) : null ;
127+ if ( this . jsonResponse !== undefined ) {
138128 return this . jsonResponse ;
139- } catch ( err ) {
140- console . error ( 'HttpsResponse.toJSON' , err ) ;
141- return null ;
142129 }
130+ // TODO: handle arraybuffer already stored
131+ this . stringResponse = this . stringResponse || this . response . asString ( ) ;
132+ this . jsonResponse = this . stringResponse ? parseJSON ( this . stringResponse ) : null ;
133+ return this . jsonResponse ;
143134 }
144135
145136 async toJSONAsync ( ) {
0 commit comments