| @@ -230,7 +230,7 @@ int js_iserror(js_State *J, int idx) · 229 unmodified lines |
| 230 | 230 | return v->type == JS_TOBJECT && v->u.object->type == JS_CERROR; |
| 231 | 231 | } |
| 232 | 232 | |
| 233 | | −static const char *js_typeof(js_State *J, int idx) |
| 233 | +const char *js_typeof(js_State *J, int idx) |
| 234 | 234 | { |
| 235 | 235 | js_Value *v = stackidx(J, idx); |
| 236 | 236 | switch (v->type) { |
| @@ -1056,7 +1056,7 @@ void js_call(js_State *J, int n) · 819 unmodified lines |
| 1056 | 1056 | int savebot; |
| 1057 | 1057 | |
| 1058 | 1058 | if (!js_iscallable(J, -n-2)) |
| 1059 | | − js_typeerror(J, "called object is not a function"); |
| 1059 | + js_typeerror(J, "%s is not callable", js_typeof(J, -n-2)); |
| 1060 | 1060 | |
| 1061 | 1061 | obj = js_toobject(J, -n-2); |
| 1062 | 1062 | |
| @@ -1090,7 +1090,7 @@ void js_construct(js_State *J, int n) · 27 unmodified lines |
| 1090 | 1090 | js_Object *newobj; |
| 1091 | 1091 | |
| 1092 | 1092 | if (!js_iscallable(J, -n-1)) |
| 1093 | | − js_typeerror(J, "called object is not a function"); |
| 1093 | + js_typeerror(J, "%s is not callable", js_typeof(J, -n-1)); |
| 1094 | 1094 | |
| 1095 | 1095 | obj = js_toobject(J, -n-1); |
| 1096 | 1096 | |