aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeoff Gustafson <geoff@linux.intel.com>2017-03-02 14:27:29 -0800
committerJimmy Huang <jimmy.huang@linux.intel.com>2017-03-02 14:27:29 -0800
commit038d6b76e2a1d92851e375e3531072476b44d649 (patch)
treea4eb1a9f1bb78441e3bbdce298adaa7c6775d886 /src
parentcdcfdef238a05c3534fbcd108253de925451aea7 (diff)
[assert] Demote AssertionError from standard to custom error (#774)
This means instanceof AssertionError won't work but you can still test the name; since this comes from one console function it doesn't seem like it should be considered a standard error. Fixes issue #735. Signed-off-by: Geoff Gustafson <geoff@linux.intel.com>
Diffstat (limited to 'src')
-rw-r--r--src/zjs_console.c4
-rw-r--r--src/zjs_error.c1
-rw-r--r--src/zjs_error.h2
3 files changed, 2 insertions, 5 deletions
diff --git a/src/zjs_console.c b/src/zjs_console.c
index 13738d4..339b9e5 100644
--- a/src/zjs_console.c
+++ b/src/zjs_console.c
@@ -239,9 +239,9 @@ static jerry_value_t console_assert(const jerry_value_t function_obj,
if (!b) {
if (argc > 1) {
value2str(argv[1], message, MAX_STR_LENGTH, false);
- return ASSERTION_ERROR(message);
+ return zjs_custom_error("AssertionError", message);
} else {
- return ASSERTION_ERROR("console.assert");
+ return zjs_custom_error("AssertionError", "console.assert");
}
}
return ZJS_UNDEFINED;
diff --git a/src/zjs_error.c b/src/zjs_error.c
index 306d569..831f2ea 100644
--- a/src/zjs_error.c
+++ b/src/zjs_error.c
@@ -9,7 +9,6 @@ typedef struct {
} zjs_error_t;
static zjs_error_t error_types[] = {
- { "AssertionError" },
{ "NetworkError" },
{ "NotSupportedError" },
{ "RangeError" },
diff --git a/src/zjs_error.h b/src/zjs_error.h
index 4b36d41..1a4f66f 100644
--- a/src/zjs_error.h
+++ b/src/zjs_error.h
@@ -6,7 +6,6 @@
#include "jerry-api.h"
typedef enum zjs_error_type {
- AssertionError,
NetworkError,
NotSupportedError,
RangeError,
@@ -46,7 +45,6 @@ jerry_value_t zjs_standard_error(zjs_error_type_t type, const char *message);
#define zjs_error(msg) (zjs_standard_error(Error, (msg)))
-#define ASSERTION_ERROR(msg) (zjs_standard_error(AssertionError, (msg)))
#define SECURITY_ERROR(msg) (zjs_standard_error(SecurityError, (msg)))
#define NOTSUPPORTED_ERROR(msg) (zjs_standard_error(NotSupportedError, (msg)))
#define SYNTAX_ERROR(msg) (zjs_standard_error(SyntaxError, (msg)))