File tree Expand file tree Collapse file tree 2 files changed +5
-4
lines changed
Expand file tree Collapse file tree 2 files changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -58,7 +58,7 @@ export default class Api2d
5858 const timeout_handle = setTimeout ( ( ) => {
5959 this . controller . abort ( ) ;
6060 // throw new Error( "Timeout "+ this.timeout );
61- reject ( new Error ( " Timeout " + this . timeout ) ) ;
61+ reject ( new Error ( `[408]: Timeout by ${ this . timeout } ms` ) ) ; z
6262 } , this . timeout ) ;
6363 const response = await fetchEventSource ( url , {
6464 signal : this . controller . signal ,
@@ -69,7 +69,7 @@ export default class Api2d
6969 {
7070 if ( response . status != 200 )
7171 {
72- throw new Error ( response . statusText ) ;
72+ throw new Error ( `[ ${ response . status } ]: ${ response . statusText } ` ) ;
7373 }
7474 } ,
7575 onmessage : e => {
@@ -92,7 +92,8 @@ export default class Api2d
9292
9393 } ,
9494 onerror : error => {
95- throw new Error ( error ) ;
95+ console . log ( error ) ;
96+ throw new Error ( `[500]:${ error } ` ) ;
9697 }
9798 } ) ;
9899
Original file line number Diff line number Diff line change 11{
22 "name" : " api2d" ,
3- "version" : " 0.1.8 " ,
3+ "version" : " 0.1.9 " ,
44 "description" : " pure browser sdk for api2d and openai" ,
55 "main" : " index.js" ,
66 "repository" : " https://github.com/easychen/api2d-js" ,
You can’t perform that action at this time.
0 commit comments