kevva / screenshot-stream

Capture screenshot of a website and return it as a stream
MIT License
236 stars 38 forks source link

fix multiline error messages #33

Closed SamVerschueren closed 8 years ago

SamVerschueren commented 8 years ago

I believe this solves https://github.com/sindresorhus/pageres/issues/256 and https://github.com/sindresorhus/pageres/issues/244.

The error expressen.se generated was the following

WARN: TypeError: Object is not a constructor (evaluating '{ 
visitor : {  
age : '0',  
gender : '0' 
}, 
inventory : {
}
}') → about:blank on line 9 in function global code

But these where logged all as individual lines. So the first line was omitted because it has WARN at the start. But the following line is visitor : { which was interpreted as a real error. By removing the newlines, it is logged as one string.

I did the same for phantom.onError. Not sure if it is necessary for a specific case but I thought it wouldn't hurt.

SamVerschueren commented 8 years ago

One moment, trying to add a test for it.

SamVerschueren commented 8 years ago

Et voila, this should be it.

kevva commented 8 years ago

Oh, yeah, this makes sense (since byline reads every line), and is a really nice fix. Thanks!

SamVerschueren commented 8 years ago

Nice! Happy this is resolved :)