diff --git a/src/MetaModelica.jl b/src/MetaModelica.jl index e65feb9..d372650 100644 --- a/src/MetaModelica.jl +++ b/src/MetaModelica.jl @@ -16,6 +16,20 @@ include("union.jl") import .UniontypeDef using .UniontypeDef using ImmutableList + +function filterMetaModelicaExceptionAndThrow(e) + if !isa(e, MetaModelicaException) && !isa(e, ImmutableListException) + if isa(e, MatchFailure) + println("MatchFailure:" + e.msg) + fflush(stdout) + else + showerror(stderr, e, catch_backtrace()) + fflush(stderr) + end + rethrow(e) + end +end + include("matchcontinue.jl") include("functionInheritance.jl") include("metaRuntime.jl") @@ -25,6 +39,7 @@ include("utilityMacros.jl") export @match, @matchcontinue, MatchFailure, ModelicaReal, ModelicaInteger export @Uniontype, @Record, @UniontypeDecl, @ExtendedFunction, @ExtendedAnonFunction export List, list, Nil, nil, Cons, cons, =>, Option, SOME, NONE, SourceInfo, SOURCEINFO +export filterMetaModelicaExceptionAndThrow export @do_threaded_for, <|, @shouldFail, sourceInfo, _cons, @importDBG export @assign diff --git a/src/matchcontinue.jl b/src/matchcontinue.jl index 15e301b..bffb170 100644 --- a/src/matchcontinue.jl +++ b/src/matchcontinue.jl @@ -325,14 +325,7 @@ function handle_match_case(value, case, tail, asserts, matchcontinue::Bool) #else # showerror(stderr, e, catch_backtrace()) #end - if !isa(e, MetaModelicaException) && !isa(e, ImmutableListException) - if isa(e, MatchFailure) - println("MatchFailure:" + e.msg) - else - showerror(stderr, e, catch_backtrace()) - end - rethrow(e) - end + filterMetaModelicaExceptionAndThrow(e) __omc_match_done = false end end