Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Make sure to throw {badfun, Term} correctly

  • Loading branch information...
commit 599c6a15327fc2d357085d554536ff6fd344876d 1 parent 04250f1
@krestenkrab krestenkrab authored
View
6 src/main/java/erjang/ERT.java
@@ -130,6 +130,10 @@ public static ErlangError badarith(BigInteger o1, EObject o2) {
throw new ErlangError(AM_BADARITH, NIL.cons(o2).cons(o1));
}
+ public static ErlangError badfun(EObject o) {
+ throw new ErlangError(new ETuple2(am_badfun, o));
+ }
+
public static final EAtom TRUE = EAtom.intern("true");
public static final EAtom FALSE = EAtom.intern("false");
@@ -355,7 +359,7 @@ public static void test_fun(EObject orig, EFun fun) {
if ((orig.testFunction()) != null) {
throw new ErlangError(new ETuple2(am_badarity, new ETuple2(orig, NIL)));
} else {
- throw new ErlangError(am_badfun, orig);
+ throw badfun(orig);
}
}
}
View
2  src/main/java/erjang/m/erlang/ErlBif.java
@@ -113,7 +113,7 @@ static EObject apply(EProc proc, EObject fun, EObject args) throws Pausable {
ETuple t = fun.testTuple();
if (t == null) {
- throw ERT.badarg(fun,args);
+ throw ERT.badfun(fun);
}
ETuple2 t2 = ETuple2.cast(t);
Please sign in to comment.
Something went wrong with that request. Please try again.