1
0
Fork 0

added test for issue #4308 (#4372)

This commit is contained in:
Jan 2018-01-22 09:22:48 +01:00 committed by GitHub
parent 172494db51
commit 41f1b31e58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 21 additions and 1 deletions

View File

@ -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
////////////////////////////////////////////////////////////////////////////////