X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.scl.runtime%2Fscl%2FPrelude.scl;fp=bundles%2Forg.simantics.scl.runtime%2Fscl%2FPrelude.scl;h=dc25349c8c04da7beab8d8b0d7d8df1187213381;hb=6a531d450a993e5fce9383670708ebc370208a76;hp=86d13fb6628e77401b7a7fd0be2866834216ffca;hpb=e70869fe486232e2a089dea816f6986caf9dd8d5;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 86d13fb66..dc25349c8 100644 --- a/bundles/org.simantics.scl.runtime/scl/Prelude.scl +++ b/bundles/org.simantics.scl.runtime/scl/Prelude.scl @@ -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