File tree Expand file tree Collapse file tree 2 files changed +3
-3
lines changed Expand file tree Collapse file tree 2 files changed +3
-3
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 ( `[408]:Timeout by ${ this . timeout } ms` ) ) ; z
61+ reject ( new Error ( `[408]:Timeout by ${ this . timeout } ms` ) ) ;
6262 } , this . timeout ) ;
6363 const response = await fetchEventSource ( url , {
6464 signal : this . controller . signal ,
@@ -93,7 +93,7 @@ export default class Api2d
9393 } ,
9494 onerror : error => {
9595 console . log ( error ) ;
96- throw new Error ( `[500]:${ error } ` ) ;
96+ throw new Error ( String ( error ) ?. match ( / \[ ( \d + ) \] / ) ?. [ 1 ] ? error : `[500]:${ error } ` ) ;
9797 }
9898 } ) ;
9999
Original file line number Diff line number Diff line change 11{
22 "name" : " api2d" ,
3- "version" : " 0.1.9 " ,
3+ "version" : " 0.1.11 " ,
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