gap-packages / JupyterKernel

Native Jupyter kernel for GAP
https://gap-packages.github.io/JupyterKernel/
BSD 3-Clause "New" or "Revised" License
19 stars 12 forks source link

Use GAP library functions to handle errors (DONT MERGE) #56

Closed ssiccha closed 6 years ago

ssiccha commented 6 years ago

~~Now that the GAP error functions can redirect their output to a chosen stream, the previously used hack is no longer needed.~~

~~Also defines the variable IsRunningJupyterKernel when inside the kernel loop. This variable is used by the library to know when to print the traceback although BreakOnError = false.~~

See new commit message below.

Fixes #38.

ssiccha commented 6 years ago

This needs https://github.com/gap-system/gap/pull/2530 to be merged.

codecov[bot] commented 6 years ago

Codecov Report

Merging #56 into master will increase coverage by 3.58%. The diff coverage is 100%.

@@            Coverage Diff             @@
##           master      #56      +/-   ##
==========================================
+ Coverage    60.7%   64.29%   +3.58%     
==========================================
  Files           9        8       -1     
  Lines         817      689     -128     
==========================================
- Hits          496      443      -53     
+ Misses        321      246      -75
Impacted Files Coverage Δ
gap/JupyterKernel.gi 78.08% <100%> (+0.1%) :arrow_up:
gap/JupyterStream.gi 42.5% <0%> (-2.5%) :arrow_down:
codecov-io commented 6 years ago

Codecov Report

Merging #56 into master will decrease coverage by 10.7%. The diff coverage is 25%.

@@           Coverage Diff            @@
##           master   #56       +/-   ##
========================================
- Coverage    60.7%   50%   -10.71%     
========================================
  Files           9     9               
  Lines         817   694      -123     
========================================
- Hits          496   347      -149     
- Misses        321   347       +26
Impacted Files Coverage Δ
gap/JupyterError.gi 0% <0%> (-41.09%) :arrow_down:
gap/JupyterKernel.gi 75.34% <100%> (-2.64%) :arrow_down:
gap/JupyterHelp.gi 0% <0%> (-43.28%) :arrow_down:
gap/JupyterRenderable.gi 70% <0%> (-20%) :arrow_down:
gap/JupyterInspection.gi 69.11% <0%> (-16.18%) :arrow_down:
gap/JupyterUtil.gi 25% <0%> (-3.75%) :arrow_down:
gap/JupyterStream.gi 42.5% <0%> (-2.5%) :arrow_down:
ssiccha commented 6 years ago

Now that the GAP error functions can redirect their output to a chosen stream, the previously used hack is no longer needed.

This commit provides a function JupyterOnBreak which prints a traceback and then skips the break loop by calling JUMP_TO_CATCH. When the jupyter kernel runs OnBreak is overwritten with JupyterOnBreak.

To use this GAP is started without the -T option.

ssiccha commented 6 years ago

This needs https://github.com/gap-system/gap/pull/2529 and https://github.com/gap-system/gap/pull/2530 to be merged in order to work.

ssiccha commented 6 years ago

This is replaced by #70.