muScript: catch runtime exceptions and wrap in LocationalException
This commit is contained in:
parent
3e143c4a92
commit
4be87948a3
|
@ -5,6 +5,7 @@ import io.gitlab.jfronny.muscript.annotations.CanThrow;
|
||||||
import io.gitlab.jfronny.muscript.annotations.UncheckedDynamic;
|
import io.gitlab.jfronny.muscript.annotations.UncheckedDynamic;
|
||||||
import io.gitlab.jfronny.muscript.data.Scope;
|
import io.gitlab.jfronny.muscript.data.Scope;
|
||||||
import io.gitlab.jfronny.muscript.data.dynamic.*;
|
import io.gitlab.jfronny.muscript.data.dynamic.*;
|
||||||
|
import io.gitlab.jfronny.muscript.error.LocationalException;
|
||||||
|
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.stream.Stream;
|
import java.util.stream.Stream;
|
||||||
|
@ -30,6 +31,8 @@ public class Call extends DynamicExpr {
|
||||||
.apply(DFinal.of(args.stream().flatMap(e -> e.get(dataRoot)).toArray(Dynamic[]::new)));
|
.apply(DFinal.of(args.stream().flatMap(e -> e.get(dataRoot)).toArray(Dynamic[]::new)));
|
||||||
} catch (DynamicTypeConversionException e) {
|
} catch (DynamicTypeConversionException e) {
|
||||||
throw e.locational(chStart, chEnd);
|
throw e.locational(chStart, chEnd);
|
||||||
|
} catch (RuntimeException e) {
|
||||||
|
throw new LocationalException(chStart, chEnd, "Could not perform call successfully", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue