marimo icon indicating copy to clipboard operation
marimo copied to clipboard

Support expected exceptions: Option to hide the traceback

Open Eloitor opened this issue 1 year ago • 3 comments

Description

In some notebooks i need to have exceptions, because they provide useful information, for example:

from sage.all_cmdline import x, var, limit, exp, oo

var("a")
limit(exp(a * x), x=oo)

Gives:

ValueError

    This cell raised an exception: ValueError('Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(a>0)', see `assume?` for more details) Is a positive, negative or zero?')

This is useful, but the traceback is not very interesting... I would like to be able to hide it.

Suggested solution

Allow the user to hide the traceback of a cell.

Alternative

No response

Additional context

No response

Eloitor avatar Feb 23 '24 11:02 Eloitor

Maybe even better to show:

Value Error:
Computation failed since Maxima requested additional constraints; using the 'assume' command before evaluation *may* help (example of legal syntax is 'assume(a>0)', see `assume?` for more details) Is a positive, negative or zero?

Eloitor avatar Feb 23 '24 11:02 Eloitor

Hi Eloitor, thanks for the feature request. We don't plan on letting users hide exceptions when editing a notebook -- we feel in general that exceptions mean that there's an error that should be brought to the user's attention. (When running a notebook with marimo run, exceptions are not shown).

If you'd like an exception to be hidden, you can catch it with a try/except.

akshayka avatar Feb 23 '24 16:02 akshayka

Perhaps one thing we could do is let you temporarily collapse/expand the console output area, in which tracebacks are shown

akshayka avatar Feb 23 '24 16:02 akshayka

Going to close this in favor of try/except

mscolnick avatar Jun 04 '24 19:06 mscolnick