javascript - How to get a proper error stack while designing application? -


before, used async.js callbacks make webapp. worked nicely -- when error occur, i'd whole stack pointing line error happened.

now, when i'm trying same async/await in node's harmony mode, errors point last catch blocks. example:

try {   await godosomething(); } catch (e) {   console.error(e); } 

now, godosomething async action, pull database, , bunch of synchronous code, process records, etc.

if error happens in synchronous code processes records, stack point catch block of code above (and not actual line error happened).

this insanely difficult debug. leaves me assumption should have these try/catch blocks multiple times throughout of code (even synchronous stuff)...?

what missing? how have normal , accurate error catching async/await?

there packages async stack trace. i'd recommend longjohn based on github stars.


Comments

Popular posts from this blog

How to understand 2 main() functions after using uftrace to profile the C++ program? -

c# - Update a combobox from a presenter (MVP) -

How to put a lock and transaction on table using spring 4 or above using jdbcTemplate and annotations like @Transactional? -