diff --git a/js/common/tests/shell-foxx-manager-install-spec.js b/js/common/tests/shell-foxx-manager-install-spec.js index 7cb249ca3b..e20a236be3 100644 --- a/js/common/tests/shell-foxx-manager-install-spec.js +++ b/js/common/tests/shell-foxx-manager-install-spec.js @@ -63,8 +63,12 @@ describe("Foxx Manager install", function() { } validateError = function(type, error) { expect(error instanceof ArangoError).toBeTruthy(); - expect(error.errorNum).toEqual(type.code, "Invalid code returned: expected " + type.code + " got " - + error.errorNum + " Message: " + String(error) + " Trace: " + error.stack); + expect(error.errorNum).toEqual( + type.code, + "Invalid code returned: expected " + type.code + " got " + error.errorNum + + " Message: " + error + + " Trace: " + error.stack + ); }; }); diff --git a/js/server/modules/org/arangodb/foxx/manager.js b/js/server/modules/org/arangodb/foxx/manager.js index 92d9e405cd..e51d963f7d 100644 --- a/js/server/modules/org/arangodb/foxx/manager.js +++ b/js/server/modules/org/arangodb/foxx/manager.js @@ -950,6 +950,7 @@ var _install = function(appInfo, mount, options, runSetup) { try { fs.removeDirectoryRecursive(targetPath, true); } catch (err) { + console.errorLines(err.stack); } try { if (!options.__clusterDistribution) { @@ -964,6 +965,21 @@ var _install = function(appInfo, mount, options, runSetup) { }); } } catch (err) { + console.errorLines(err.stack); + } + if (e instanceof ArangoError) { + if (e.errorNum === errors.ERROR_MODULE_SYNTAX_ERROR.code) { + throw _.extend(new ArangoError({ + errorNum: errors.ERROR_SYNTAX_ERROR_IN_SCRIPT.code, + errorMessage: errors.ERROR_SYNTAX_ERROR_IN_SCRIPT.message + }), {stack: e.stack}); + } + if (e.errorNum === errors.ERROR_MODULE_FAILURE.code) { + throw _.extend(new ArangoError({ + errorNum: errors.ERROR_FAILED_TO_EXECUTE_SCRIPT.code, + errorMessage: errors.ERROR_FAILED_TO_EXECUTE_SCRIPT.message + }), {stack: e.stack}); + } } throw e; }