AriaMinaei / pretty-error

See node.js errors with less clutter
MIT License
1.52k stars 48 forks source link

How to turn of line wrapping #19

Open vjpr opened 9 years ago

vjpr commented 9 years ago

I couldn't figure out a way to turn of line wrapping.

In CSS it would be white-space: nowrap, but its seems in RenderKid you are setting a terminal width.

My use case is that I am rendering urls which need to be clickable (using CMD + double-click on OSX). For this reason I cannot have line breaks in between urls.

vjpr commented 9 years ago

For a start it would be good to be able to pass config to RenderKid - https://github.com/AriaMinaei/pretty-error/blob/master/src/pretty-error.coffee#L39.

EDIT: This did not work. Looks like in Layout there is a config property called width that is set to 80, but cannot be configured anywhere.

AriaMinaei commented 9 years ago

Hey @vjpr, thanks for the suggestion. Since it's been a while since you opened this issue (sry for that), I'll wait to see if you still need it fixed. So, let me know.

adoyle-h commented 8 years ago

+1 for supporting an option to turn off line wrapping.

It displays weird when the error message has too many words.

e.g.

var PrettyError = require('pretty-error');
var pe = new PrettyError();
var renderedError = pe.render(new Error('this is a looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong message'));
console.log(renderedError);

it shows that:

image

AriaMinaei commented 8 years ago

@adoyle-h: This was a bug in RenderKid, where it couldn't correctly query the terminal's width, so it would just guess '80'. I've pushed a fix which will land in RenderKid 2.0, and pretty-error 2.0.

adoyle-h commented 8 years ago

@AriaMinaei Thanks a lot

jonjaques commented 8 years ago

@AriaMinaei This does work, however I have to react into the object to set it. Would be cool if PrettyError constructor took an options hash.

pe._renderer._config.terminalWidth = 9999

jfmmm commented 6 years ago

Another problem is that trying to add color with chalk to an error message will break the terminalWidth.