From 41f1b31e58a8a323e1704b59e4fac15a04f34454 Mon Sep 17 00:00:00 2001 From: Jan Date: Mon, 22 Jan 2018 09:22:48 +0100 Subject: [PATCH] added test for issue #4308 (#4372) --- js/common/tests/shell/shell-transactions.js | 22 ++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/js/common/tests/shell/shell-transactions.js b/js/common/tests/shell/shell-transactions.js index 5c0ae410e8..a12bb396ce 100644 --- a/js/common/tests/shell/shell-transactions.js +++ b/js/common/tests/shell/shell-transactions.js @@ -1,5 +1,5 @@ /*jshint globalstrict:false, strict:false */ -/*global assertEqual, fail */ +/*global assertEqual, assertTrue, assertMatch, fail */ //////////////////////////////////////////////////////////////////////////////// /// @brief tests for client/server side transaction invocation @@ -32,6 +32,7 @@ var jsunity = require("jsunity"); var arangodb = require("@arangodb"); var internal = require("internal"); var ERRORS = arangodb.errors; +var ArangoError = require("@arangodb").ArangoError; var cluster; var isOnServer = (typeof ArangoClusterComm === "object"); if (isOnServer) { @@ -65,6 +66,25 @@ function TransactionsInvocationsSuite () { internal.wait(0); }, + testErrorHandling : function () { + try { + db._executeTransaction({ + collections: {}, + action: function() { + var err = new Error('test'); + Object.defineProperty(err, 'name', { + get: function() { throw new Error('Error in getter'); } + }); + throw err; + } + }); + fail(); + } catch (err) { + assertTrue(err instanceof ArangoError); + assertMatch(/test/, err.errorMessage); + } + }, + //////////////////////////////////////////////////////////////////////////////// /// @brief execute a transaction with a string action ////////////////////////////////////////////////////////////////////////////////