posthtml / gulp-posthtml

PostHTML for Gulp
Other
18 stars 4 forks source link

Improve emitting errors and show stack #16

Closed silvenon closed 4 years ago

silvenon commented 4 years ago

Notable Changes

This makes error handling more liberal, supporting errors from posthtml-expressions that aren't instances of Error, see posthtml/posthtml-expressions#89. Also, now error stack is displayed, which is very useful for plugins like gulp-posthtml.

Without stack:

``` Message: Cannot read property 'bar' of undefined Details: domainEmitter: [object Object] domainThrown: false ```

With stack:

``` Message: Cannot read property 'bar' of undefined Details: domainEmitter: [object Object] domainThrown: false Stack: evalmachine.:1 foo.bar ^ TypeError: Cannot read property 'bar' of undefined at evalmachine.:1:5 at Script.runInContext (vm.js:141:18) at Object.runInContext (vm.js:279:6) at placeholders (/Users/silvenon/Code/repro/node_modules/posthtml-expressions/lib/placeholders.js:57:20) at /Users/silvenon/Code/repro/node_modules/posthtml-expressions/lib/index.js:182:14 at Array.reduce () at walk (/Users/silvenon/Code/repro/node_modules/posthtml-expressions/lib/index.js:169:27) at /Users/silvenon/Code/repro/node_modules/posthtml-expressions/lib/index.js:206:22 at Array.reduce () at walk (/Users/silvenon/Code/repro/node_modules/posthtml-expressions/lib/index.js:169:27) ```

I tried adding a test, but there is some weird race condition going on when running that test with sugarml tests, and I wasn't able to figure out what was going on there.

Commit Message Summary (CHANGELOG)

Improve emitting errors and show stack

  - now errors from posthtml-expressions are properly displayed

Type

SemVer

Issues

Checklist

coveralls commented 4 years ago

Coverage Status

Coverage remained the same at 87.097% when pulling 253a944bcaffb68c6b86afa2b326f0c5ab54aad5 on silvenon:improve-error-handling into 79483f47d63e8c8f4003dc419fb9f662c52f0a19 on posthtml:master.

silvenon commented 4 years ago

I wasn't able to reproduce the test failure on Node v4 😕

Scrum commented 4 years ago

@silvenon thanks for good work, publish v3.0.5

silvenon commented 4 years ago

You're welcome, and thank you for responding quickly!