Skip to content
This repository was archived by the owner on May 23, 2019. It is now read-only.

Conversation

@Announcement
Copy link

when setting an erroneous code, throwing a freshly created (type)error message does not display well.
consider the following line of code:

new algebra.Expression(new Fraction(1,1))

old output

pay special attention to the second line of the codeblock.

$ node source/cas
C:\Users\Francis\Documents\Projects\app\node_modules\algebra.js\src\expressions.js:23
        throw new TypeError("Invalid Argument (" + variable.toString() + "): Argument must be of type String, Integer, Fraction or Term.");
        ^

TypeError: Invalid Argument (0): Argument must be of type String, Integer, Fraction or Term.
    at new Expression (C:\Users\Francis\Documents\Projects\app\node_modules\algebra.js\src\expressions.js:23:15)
    at mean (C:\Users\Francis\Documents\Projects\app\source\cas.js:72:16)
    at Object.<anonymous> (C:\Users\Francis\Documents\Projects\app\source\cas.js:86:13)
    at Module._compile (module.js:641:30)
    at Object.Module._extensions..js (module.js:652:10)
    at Module.load (module.js:560:32)
    at tryModuleLoad (module.js:503:12)
    at Function.Module._load (module.js:495:3)
    at Function.Module.runMain (module.js:682:10)
    at startup (bootstrap_node.js:191:16)

New output

the same line is much cleaner and closer to what a user would expect; the actually ExpressionError: line is still the same.

C:\Users\Francis\Documents\GitHub\algebra.js\src\expressions.js:33                                
        throw new ExpressionError(variable);                                                      
        ^                                                                                         
                                                                                                  
ExpressionError: Invalid Argument (7): Argument must be of type String, Integer, Fraction or Term.
    at new ExpressionError (C:\Users\Francis\Documents\GitHub\algebra.js\src\expressions.js:7:11) 
    at new Expression (C:\Users\Francis\Documents\GitHub\algebra.js\src\expressions.js:33:15)     
    at mean (C:\Users\Francis\Documents\Projects\app\source\cas.js:78:16)                         
    at Object.<anonymous> (C:\Users\Francis\Documents\Projects\app\source\cas.js:86:13)           
    at Module._compile (module.js:641:30)                                                         
    at Object.Module._extensions..js (module.js:652:10)                                           
    at Module.load (module.js:560:32)                                                             
    at tryModuleLoad (module.js:503:12)                                                           
    at Function.Module._load (module.js:495:3)                                                    
    at Function.Module.runMain (module.js:682:10)                                                 

@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) to 98.09% when pulling 932a052 on Announcement:master into 8c74b87 on nicolewhite:master.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants