al6x / synchronize

Write asynchronous code as if it's synchronous
http://alexeypetrushin.github.com/synchronize
316 stars 57 forks source link

Fix bugs in error handling #69

Closed Gurrt closed 5 years ago

Gurrt commented 5 years ago

We were running into issues when an error fired within nested fibers. This is because defineProperties sets the property as immutable. Which the next fiber then tries to set to the new callback, causing your program to crash. This is fixed by setting the configurable property to true.

Another issue we encountered was that synchronize crashes if decorateError encounters a non-object error for some reason. This can be fixed by explicitly checking if error is an object before calling defineProperties.