Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better error formatting and cli color #586

Merged
merged 3 commits into from
Jul 23, 2020
Merged

Conversation

HalidOdat
Copy link
Member

@HalidOdat HalidOdat commented Jul 22, 2020

This Pull Request fixes/closes #507 .

It changes the following:

  • Better error formatting errorName: message, example TypeError: 'this' is not an object
  • Made readline ("> ") bold cyan color
  • uncaught errors: Uncaught: errorMessage in red in cli

Example:
Screenshot_2020-07-22_04-59-11

@HalidOdat HalidOdat added enhancement New feature or request cli Issues and PRs related to the Boa command line interface. execution Issues or PRs related to code execution labels Jul 22, 2020
@HalidOdat HalidOdat added this to the v0.10.0 milestone Jul 22, 2020
@codecov
Copy link

codecov bot commented Jul 22, 2020

Codecov Report

Merging #586 into master will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #586      +/-   ##
==========================================
+ Coverage   71.10%   71.13%   +0.03%     
==========================================
  Files         177      177              
  Lines       11420    11425       +5     
==========================================
+ Hits         8120     8127       +7     
+ Misses       3300     3298       -2     
Impacted Files Coverage Δ
boa_cli/src/main.rs 33.33% <ø> (ø)
boa/src/builtins/value/display.rs 77.38% <100.00%> (+1.43%) ⬆️
boa/src/builtins/object/mod.rs 42.00% <0.00%> (+0.91%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update bbd7dd2...f7e231c. Read the comment docs.

@github-actions
Copy link

Benchmark for b656f0c

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 375.1±10.82ns 375.1±13.32ns 0.00%
Arithmetic operations (Full) 162.3±4.65µs 159.5±5.78µs +1.76%
Array access (Execution) 13.4±0.42µs 13.4±0.47µs 0.00%
Array access (Full) 183.2±3.81µs 186.5±7.91µs -1.77%
Array creation (Execution) 3.7±0.13ms 3.8±0.09ms -2.63%
Array creation (Full) 4.0±0.12ms 4.1±0.09ms -2.44%
Array pop (Execution) 1453.4±109.74µs 1483.0±77.13µs -2.00%
Array pop (Full) 1717.2±39.58µs 1796.8±64.82µs -4.43%
Boolean Object Access (Execution) 4.2±0.17µs 4.1±0.12µs +2.44%
Boolean Object Access (Full) 172.8±6.84µs 171.4±9.63µs +0.82%
Create Realm 150.4±4.38µs 151.3±6.84µs -0.59%
Dynamic Object Property Access (Execution) 6.3±0.14µs 6.4±0.22µs -1.56%
Dynamic Object Property Access (Full) 178.8±20.28µs 174.7±7.67µs +2.35%
Expression (Lexer) 2.3±0.18µs 2.3±0.07µs 0.00%
Expression (Parser) 5.3±0.13µs 5.3±0.32µs 0.00%
Fibonacci (Execution) 972.6±61.50µs 957.7±28.17µs +1.56%
Fibonacci (Full) 1158.6±56.61µs 1167.1±26.60µs -0.73%
For loop (Execution) 22.3±0.54µs 22.3±0.81µs 0.00%
For loop (Full) 189.7±6.85µs 190.4±9.33µs -0.37%
For loop (Lexer) 5.1±0.11µs 5.1±0.19µs 0.00%
For loop (Parser) 13.8±0.41µs 13.8±0.44µs 0.00%
Goal Symbols (Parser) 8.4±0.31µs 8.3±0.24µs +1.20%
Hello World (Lexer) 799.1±20.55ns 781.9±25.17ns +2.20%
Hello World (Parser) 2.1±0.05µs 2.1±0.05µs 0.00%
Long file (Parser) 6.2±0.19ms 6.1±0.16ms +1.64%
Number Object Access (Execution) 3.4±0.17µs 3.3±0.10µs +3.03%
Number Object Access (Full) 172.0±6.91µs 171.4±8.91µs +0.35%
Object Creation (Execution) 5.5±0.20µs 5.6±0.26µs -1.79%
Object Creation (Full) 194.8±15.80µs 192.7±8.28µs +1.09%
RegExp (Execution) 66.6±3.68µs 65.9±2.74µs +1.06%
RegExp (Full) 252.4±12.12µs 249.2±6.80µs +1.28%
RegExp Literal (Execution) 69.6±3.65µs 71.3±3.03µs -2.38%
RegExp Literal (Full) 247.9±11.97µs 241.3±5.98µs +2.74%
RegExp Literal Creation (Execution) 65.9±2.76µs 65.8±4.33µs +0.15%
RegExp Literal Creation (Full) 287.4±10.12µs 283.7±9.70µs +1.30%
Static Object Property Access (Execution) 5.6±0.14µs 5.8±0.38µs -3.45%
Static Object Property Access (Full) 174.8±5.71µs 172.0±6.45µs +1.63%
String Object Access (Execution) 8.0±0.17µs 8.0±0.41µs 0.00%
String Object Access (Full) 174.7±4.97µs 173.8±12.20µs +0.52%
String comparison (Execution) 6.7±0.26µs 6.4±0.16µs +4.69%
String comparison (Full) 178.2±7.52µs 171.4±8.35µs +3.97%
String concatenation (Execution) 5.4±0.16µs 5.3±0.23µs +1.89%
String concatenation (Full) 174.2±9.30µs 169.7±11.33µs +2.65%
String copy (Execution) 4.3±0.63µs 4.1±0.15µs +4.88%
String copy (Full) 173.7±10.23µs 160.5±5.27µs +8.22%
Symbols (Execution) 3.6±0.12µs 3.6±0.12µs 0.00%
Symbols (Full) 162.7±7.63µs 163.9±9.78µs -0.73%

@Razican
Copy link
Member

Razican commented Jul 22, 2020

About using ansi_term. Do we use it for anything else than coloring? We could use colored, as we do in the test262 tester.

@github-actions
Copy link

Benchmark for 4179a2f

Click to view benchmark
Test PR Benchmark Master Benchmark %
Arithmetic operations (Execution) 395.6±14.89ns 397.9±19.40ns -0.58%
Arithmetic operations (Full) 184.3±8.93µs 194.2±115.01µs -5.10%
Array access (Execution) 15.4±1.74µs 14.5±0.57µs +6.21%
Array access (Full) 218.5±56.18µs 198.7±6.78µs +9.96%
Array creation (Execution) 4.2±0.19ms 4.2±0.24ms 0.00%
Array creation (Full) 4.4±0.14ms 4.5±0.14ms -2.22%
Array pop (Execution) 1564.3±48.68µs 1676.9±119.92µs -6.71%
Array pop (Full) 1939.2±101.43µs 1965.2±112.81µs -1.32%
Boolean Object Access (Execution) 4.8±0.39µs 4.5±0.27µs +6.67%
Boolean Object Access (Full) 201.5±99.76µs 200.6±30.74µs +0.45%
Create Realm 170.3±12.93µs 169.2±10.56µs +0.65%
Dynamic Object Property Access (Execution) 7.0±0.29µs 7.2±0.54µs -2.78%
Dynamic Object Property Access (Full) 195.3±11.77µs 202.4±27.58µs -3.51%
Expression (Lexer) 2.5±0.12µs 2.5±0.11µs 0.00%
Expression (Parser) 5.8±0.31µs 6.0±0.47µs -3.33%
Fibonacci (Execution) 1025.2±29.82µs 1042.8±81.78µs -1.69%
Fibonacci (Full) 1292.7±55.43µs 1293.2±93.00µs -0.04%
For loop (Execution) 24.3±1.21µs 23.9±1.91µs +1.67%
For loop (Full) 206.8±8.02µs 207.5±12.04µs -0.34%
For loop (Lexer) 5.8±0.63µs 5.6±0.30µs +3.57%
For loop (Parser) 15.4±1.20µs 15.0±0.48µs +2.67%
Goal Symbols (Parser) 9.0±0.34µs 9.0±0.36µs 0.00%
Hello World (Lexer) 908.1±99.24ns 877.0±48.32ns +3.55%
Hello World (Parser) 2.3±0.16µs 2.4±0.14µs -4.17%
Long file (Parser) 7.0±0.31ms 6.8±0.19ms +2.94%
Number Object Access (Execution) 3.5±0.12µs 3.6±0.33µs -2.78%
Number Object Access (Full) 195.1±19.10µs 185.8±8.83µs +5.01%
Object Creation (Execution) 6.2±0.48µs 6.1±0.49µs +1.64%
Object Creation (Full) 221.4±22.04µs 208.7±6.33µs +6.09%
RegExp (Execution) 73.5±5.40µs 71.9±3.79µs +2.23%
RegExp (Full) 283.8±19.92µs 269.8±15.32µs +5.19%
RegExp Literal (Execution) 79.9±14.53µs 79.1±7.93µs +1.01%
RegExp Literal (Full) 278.6±17.17µs 272.5±32.06µs +2.24%
RegExp Literal Creation (Execution) 75.8±7.31µs 72.3±3.40µs +4.84%
RegExp Literal Creation (Full) 314.9±18.08µs 324.9±20.19µs -3.08%
Static Object Property Access (Execution) 6.2±0.44µs 6.1±0.26µs +1.64%
Static Object Property Access (Full) 196.1±12.34µs 189.2±7.23µs +3.65%
String Object Access (Execution) 9.2±0.79µs 8.7±0.63µs +5.75%
String Object Access (Full) 200.9±12.31µs 196.9±15.97µs +2.03%
String comparison (Execution) 7.0±0.28µs 6.8±0.24µs +2.94%
String comparison (Full) 193.8±10.56µs 191.0±7.68µs +1.47%
String concatenation (Execution) 5.9±0.43µs 5.8±0.54µs +1.72%
String concatenation (Full) 193.0±11.38µs 188.9±10.82µs +2.17%
String copy (Execution) 4.6±0.41µs 4.5±0.17µs +2.22%
String copy (Full) 193.1±16.94µs 189.1±15.23µs +2.12%
Symbols (Execution) 4.0±0.32µs 4.0±0.27µs 0.00%
Symbols (Full) 177.4±9.17µs 181.3±14.04µs -2.15%

@HalidOdat HalidOdat closed this Jul 23, 2020
@HalidOdat HalidOdat reopened this Jul 23, 2020
@HalidOdat HalidOdat merged commit 795adc5 into master Jul 23, 2020
@HalidOdat HalidOdat deleted the better-error-formatting branch July 23, 2020 15:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issues and PRs related to the Boa command line interface. enhancement New feature or request execution Issues or PRs related to code execution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ReferenceError on cli prints full obj properties instead of short message
3 participants