NSLS-II / nslsii

NSLS-II related devices
BSD 3-Clause "New" or "Revised" License
10 stars 21 forks source link

ENH: make minimal traceback reporting optional #91

Closed tacaswell closed 3 years ago

tacaswell commented 4 years ago

Because sometimes you do want to see the full tracebacks.

codecov-commenter commented 4 years ago

Codecov Report

Merging #91 into master will not change coverage. The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##           master      #91   +/-   ##
=======================================
  Coverage   66.66%   66.66%           
=======================================
  Files           1        1           
  Lines           3        3           
=======================================
  Hits            2        2           
  Misses          1        1           

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 a689bd6...7e1d1a8. Read the comment docs.

klauer commented 4 years ago

It'd be nice if there were an exception stashing mechanism that worked like:

In [6]: %xmode minimal
Exception reporting mode: Minimal

In [7]: def test():
   ...:     raise Exception('oops')
   ...:

In [8]: test()
Exception: oops
(To see the full exception, run `%xstashed 4`)

In [9]: %xstashed 4
---------------------------------------------------------------------------
Exception                                 Traceback (most recent call last)
<ipython-input-11-fbd55f77ab7c> in <module>
----> 1 test()
        global test = <function test at 0x10fa3a9e0>

<ipython-input-7-5f7df1f0ec85> in test()
      1 def test():
----> 2     raise Exception('oops')
        global Exception = undefined
      3

Exception: oops

Of course %debug could be used so long as you're only interested in the last raised exception. At least with the above, even old exceptions could be reviewed interactively. </hijack>

tacaswell commented 4 years ago

@klauer That request should probably go to IPython

danielballan commented 4 years ago

I think it exists: https://ipython.readthedocs.io/en/stable/interactive/magics.html#magic-tb

danielballan commented 4 years ago

Ah, not exactly. I somewhat misinterpreted @klauer’s comment on my initial reading. Nonetheless that might be interesting.

klauer commented 4 years ago

Just throwing it out there 🤷‍♂️