Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Catch errors of asynchronous functions with prior stacktrace

NotificationsYou must be signed in to change notification settings

sagiavinash/with-stacktrace

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

15 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A helper to catch errors from asynchronous tasks with prior stacktrace

Installation

npm install --save with-stacktrace

or

yarn add with-stacktrace

Example Usage

importwithStacktracefrom'with-stacktrace';functiona(){b();}functionb(){withStacktrace(newPromise(functionasyncTask(resolve,reject){setTimeout(()=>{reject(newError('async error'));});})).catch(function(errorWithTrace){console.log(errorWithTrace.stack);/* captured stacktrace (before using withStacktrace)      Error: async error        at setTimeout    *//* captured stacktrace (after using withStacktrace)      Error: async error        at setTimeout (pen.js:32)        at b (pen.js:30)        at a (pen.js:26)        at pen.js:40    */});}a();

About

Catch errors of asynchronous functions with prior stacktrace

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

[8]ページ先頭

©2009-2025 Movatter.jp