File tree Expand file tree Collapse file tree 3 files changed +12
-15
lines changed
ownlang-core/src/main/java/com/annimon/ownlang
ownlang-parser/src/main/java/com/annimon/ownlang/parser/ast Expand file tree Collapse file tree 3 files changed +12
-15
lines changed Original file line number Diff line number Diff line change 3
3
/**
4
4
* Base type for all runtime exceptions
5
5
*/
6
- public abstract class OwnLangRuntimeException extends RuntimeException {
6
+ public class OwnLangRuntimeException extends RuntimeException {
7
7
8
8
public OwnLangRuntimeException () {
9
9
super ();
@@ -12,4 +12,8 @@ public OwnLangRuntimeException() {
12
12
public OwnLangRuntimeException (String message ) {
13
13
super (message );
14
14
}
15
+
16
+ public OwnLangRuntimeException (String message , Throwable ex ) {
17
+ super (message , ex );
18
+ }
15
19
}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ public static synchronized void clear() {
14
14
}
15
15
16
16
public static synchronized void enter (String name , Function function ) {
17
- calls .push (new CallInfo (name , function ));
17
+ calls .push (new CallInfo (name , function . toString () ));
18
18
}
19
19
20
20
public static synchronized void exit () {
@@ -25,10 +25,10 @@ public static synchronized Deque<CallInfo> getCalls() {
25
25
return calls ;
26
26
}
27
27
28
- public record CallInfo (String name , Function function ) {
28
+ public record CallInfo (String name , String function ) {
29
29
@ Override
30
30
public String toString () {
31
- return String .format ("%s: %s" , name , function . toString (). trim () );
31
+ return String .format ("%s: %s" , name , function );
32
32
}
33
33
}
34
34
}
Original file line number Diff line number Diff line change 1
1
package com .annimon .ownlang .parser .ast ;
2
2
3
- import com .annimon .ownlang .exceptions .ArgumentsMismatchException ;
4
- import com .annimon .ownlang .exceptions .TypeException ;
5
- import com .annimon .ownlang .exceptions .VariableDoesNotExistsException ;
6
- import com .annimon .ownlang .exceptions .UnknownFunctionException ;
3
+ import com .annimon .ownlang .exceptions .*;
7
4
import com .annimon .ownlang .lib .*;
8
5
import java .util .ArrayList ;
9
6
import java .util .Iterator ;
@@ -42,13 +39,9 @@ public Value eval() {
42
39
}
43
40
final Function f = consumeFunction (functionExpr );
44
41
CallStack .enter (functionExpr .toString (), f );
45
- try {
46
- final Value result = f .execute (values );
47
- CallStack .exit ();
48
- return result ;
49
- } catch (ArgumentsMismatchException | TypeException | VariableDoesNotExistsException ex ) {
50
- throw new RuntimeException (ex .getMessage () + " in function " + functionExpr , ex );
51
- }
42
+ final Value result = f .execute (values );
43
+ CallStack .exit ();
44
+ return result ;
52
45
}
53
46
54
47
private Function consumeFunction (Expression expr ) {
You can’t perform that action at this time.
0 commit comments