In Kotlin Notebooks, is there a way to catch excep...
# datascience
p
In Kotlin Notebooks, is there a way to catch exceptions before they are displayed in the output of a cell so they can be formatted a bit nicer?
a
A general try/catch should work. It should not be hard to add exception interceptor to cell evaluator though.
p
Where would I put the try/catch? Not in the before or after cell execution I assume.
a
Just wrap the problematic code with try/catch and use Notebook reflection to display proper information.
Let me check, maybe there is already something in notebook reflection api for that
p
Hmm, that would be very tricky if I understand correctly. If not an exception, what would that try/catch block return. Would my method suddenly return Any type as a consequence. The primary use case is require, so IllegalArgument exceptions.
a
I do not see exception catching in current API, I think it makes sense to create an issue.
p
OK, I assume GitHub is the place (kotlin-jupyter)?
a
yep.
p
Will create an issue, thanks for the help!!!
a
It should be not hard to add. The scripting API provide exception handlers
p
a
thanks