Commit 6bf25335 authored by Sumit Sahrawat's avatar Sumit Sahrawat

Prevent kernel crash due to click handlers

Catch SomeException in IHaskell.Eval.Evaluate.capturedIO
Click handlers can now use error and undefined.
All exceptions are caught, which might also cause problems.
parent a8bba358
......@@ -1179,7 +1179,10 @@ capturedEval output stmt = do
data AnyException = NoException | AnyException SomeException
capturedIO :: Publisher -> KernelState -> IO a -> Interpreter Display
capturedIO publish state action = evalStatementOrIO publish state (Right action)
capturedIO publish state action = do
let showError = return . displayError . show
handler e@SomeException{} = showError e
gcatch (evalStatementOrIO publish state (Right action)) handler
evalStatementOrIO :: Publisher -> KernelState -> Either String (IO a) -> Interpreter Display
evalStatementOrIO publish state cmd = do
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment