Interesting. Makes sense if you've got the CordovaError at the bottom of a
file that uses, but I think it's moot if you put CordovaError into its own
module.


On Mon, Jan 20, 2014 at 2:20 PM, Mark Koudritsky <[email protected]> wrote:

>    This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/17064/
>
> On January 20th, 2014, 1:53 a.m. UTC, *Andrew Grieve* wrote:
>
>   
> src/util.js<https://reviews.apache.org/r/17064/diff/1/?file=427259#file427259line221>
>  (Diff
> revision 1)
>
> 221
>
>   this.constructor.prototype.__proto__ = Error.prototype
>
>   No need to do this within the function. You should do it after defining the 
> function:
> CordovaError.prototype.__proto__ = ...
>
>  The argument the guy from the stack overflow link gives for assigning the 
> prototype inside the constructor, is that this way you can put the definition 
> wherever you want. If prototype assignment is done outside the func, you must 
> be careful to put it before any other code in the same file wants to throw 
> that error. The case seems relatively rare, but would probably lead to a 
> pretty obscure bug. Not sure how strong this argument is.
>
>
> - Mark
>
> On January 17th, 2014, 7:36 p.m. UTC, Mark Koudritsky wrote:
>   Review request for cordova.
> By Mark Koudritsky.
>
> *Updated Jan. 17, 2014, 7:36 p.m.*
>  *Bugs: * CB-5782 <https://issues.apache.org/jira/browse/CB-5782>
>  *Repository: * cordova-cli
> Description
>
> The on('uncaughtException') handler was removed recently in cordova-cli 
> because
> it was hiding the stack traces of some legit exceptions, but this results in
> scary traces for simple errors like running outside a corodva project.
>
> This change reintroduces the on('uncaughtException') handler and adds a 
> special
> CordovaError class for such simple errors. For exceptions of CordovaError 
> class
> only the message will be printed, for all other errors - the full stack trace.
>
> Another pass over the code will be needed to find and convert the Errors to
> CordovaErrors where appropriate. Will be done in a separate change.
>
>   Testing
>
> npm test
> cordova plugin ls (inside and outside a a proj)
> cordova bad_command
>
>   Diffs
>
>    - src/cli.js (d22ba56)
>    - src/util.js (278172a)
>
> View Diff <https://reviews.apache.org/r/17064/diff/>
>

Reply via email to