You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Some of sdk methods are throwing errors, while some developers do not want to catch them by .catch() method or try {} catch {} construction, they want to see an error as a result of function execution.
Describe the solution you'd like
typeSuccessResponse<T>={success: true;data: T;};typeErrorResponse={success: false;err: unknown;};typeSafeExecuteResponse<T>=SuccessResponse<T>|ErrorResponse;asyncfunctionsafeExecute<T>(callback: ()=>T|Promise<T>): Promise<SafeExecuteResponse<T>>{try{constdata=awaitcallback()return{success: true,data: data,};}catch(err){return{success: false,err: err,};}}constexample=async()=>{constsomeSafeResponse=awaitsafeExecute(()=>{return1})if(someSafeResponse.success){console.info(`Yeey! We did it! ${someSafeResponse.data}`)}if(!someSafeResponse.success){console.error(`Damn, this is not what we expected... ${someSafeResponse.err}`)}}example()
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
Some of sdk methods are throwing errors, while some developers do not want to catch them by
.catch()
method ortry {} catch {}
construction, they want to see an error as a result of function execution.Describe the solution you'd like
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: