Mithril.js: [ospec] newlines in error messages confuse the error reporter

Created on 25 Dec 2016  路  5Comments  路  Source: MithrilJS/mithril.js

Description:

The presence of newlines in error messages cause a line of said message to be displayed instead of the stack trace

Steps to Reproduce:

https://runkit.com/58603d35d1b6b10013e1e652/58603d36d1b6b10013e1e653

Bug

All 5 comments

I'll note it wasn't exactly trivial for me to nix it in a cross-runtime setting. Note that if you were to rip the code off, you'll need to remove the calls to formatLineBreaks.

Closing, since this issue has not been updated in over a month, and typically, issues inactive for that long do not usually produce any action. If you feel something in Mithril needs added or changed, please file a new issue.

The issue is still present.

Hmmm how about this:

- var stackTrace = r.error.match(/^(?:(?!Error|[\/\\]ospec[\/\\]ospec\.js).)*$/m)
+ var stackTrace = r.error.match(/^(?:(?!Error|[\/\\]ospec[\/\\]ospec\.js).)*$/gm).slice(-1)

I think there's better approaches, but this one keeps the regex the same. It just captures extra groups that also match the description (m -> gm), and picks the last one (.slice(-1)).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

hadihammurabi picture hadihammurabi  路  4Comments

ozgurrgul picture ozgurrgul  路  3Comments

barneycarroll picture barneycarroll  路  3Comments

josephys picture josephys  路  4Comments

raykyri picture raykyri  路  4Comments