X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.runtime%2Fscl%2FPrelude.scl;h=dc25349c8c04da7beab8d8b0d7d8df1187213381;hb=a472ceaa29534d553e2af893e268b6a13bffa441;hp=f983251093272d2168cb9eacc05db4542660afa0;hpb=278798fde2299d295af15addb3053d7101ccb17c;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.scl.runtime/scl/Prelude.scl b/bundles/org.simantics.scl.runtime/scl/Prelude.scl index f98325109..dc25349c8 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -75,7 +75,7 @@ infixl 6 (+), (-) infixl 5 (\\), (<<), (<+) infix 4 (!=), (<), (<=), (>=), (>) infixr 3 (&&), (&<&) -infixr 2 (||), orElse, morelse +infixr 2 (||), orElse, orElseM, morelse infixr 1 (>>=), (>>), (:=), (>=>) infixr 1 ($) infixl 1 catch @@ -2264,7 +2264,7 @@ importJava "java.lang.Throwable" where showThrowable :: Throwable -> String @private @JavaName getMessage - getMessageThrowable :: Throwable -> String + getMessageThrowable :: Throwable -> Maybe String @private @JavaName getCause getCauseThrowable :: Throwable -> Maybe Throwable @@ -2283,7 +2283,12 @@ class Throwable e where toThrowable :: e -> Throwable messageOfException :: Throwable e => e -> String -messageOfException = getMessageThrowable . toThrowable +messageOfException e = match getMessageThrowable $ toThrowable e with + Just m -> m + Nothing -> "" + +possibleMessageOfException :: Throwable e => e -> Maybe String +possibleMessageOfException e = getMessageThrowable $ toThrowable e causeOfException :: Throwable e => e -> Maybe Throwable causeOfException = getCauseThrowable . toThrowable