1
0
Fork 0

ERROR_APPLICATION_* -> ERROR_SERVICE_*

This commit is contained in:
Alan Plum 2016-06-17 19:08:41 +02:00
parent 9375d49c8c
commit 8a640eb1b5
No known key found for this signature in database
GPG Key ID: 8ED72A9A323B6EFD
14 changed files with 67 additions and 67 deletions

View File

@ -98,19 +98,19 @@ installer.use(function (req, res, next) {
if (e.isArangoError && [
errors.ERROR_MODULE_FAILURE.code,
errors.ERROR_MALFORMED_MANIFEST_FILE.code,
errors.ERROR_INVALID_APPLICATION_MANIFEST.code
errors.ERROR_INVALID_SERVICE_MANIFEST.code
].indexOf(e.errorNum) !== -1) {
res.throw('bad request', e);
}
if (
e.isArangoError &&
e.errorNum === errors.ERROR_APP_NOT_FOUND.code
e.errorNum === errors.ERROR_SERVICE_NOT_FOUND.code
) {
res.throw('not found', e);
}
if (
e.isArangoError &&
e.errorNum === errors.ERROR_APP_MOUNTPOINT_CONFLICT.code
e.errorNum === errors.ERROR_SERVICE_MOUNTPOINT_CONFLICT.code
) {
res.throw('conflict', e);
}

File diff suppressed because one or more lines are too long

View File

@ -5,7 +5,7 @@
// mop: copy paste from common/bootstrap/errors.js
var errors = {
"ERROR_APPLICATION_DOWNLOAD_FAILED" : { "code" : 1752, "message" : "application download failed" },
"ERROR_SERVICE_DOWNLOAD_FAILED" : { "code" : 1752, "message" : "service download failed" },
};
var appStoreTemplate = templateEngine.createTemplate("applicationListView.ejs");
@ -31,7 +31,7 @@
res = result.responseJSON;
}
switch(res.errorNum) {
case errors.ERROR_APPLICATION_DOWNLOAD_FAILED.code:
case errors.ERROR_SERVICE_DOWNLOAD_FAILED.code:
arangoHelper.arangoError("Services", "Unable to download application from the given repository.");
break;
default:

View File

@ -242,8 +242,8 @@ var moveAppToServer = function(serviceInfo) {
}
if (! response.filename) {
throw new ArangoError({
errorNum: errors.ERROR_APPLICATION_UPLOAD_FAILED.code,
errorMessage: errors.ERROR_APPLICATION_UPLOAD_FAILED.message
errorNum: errors.ERROR_SERVICE_UPLOAD_FAILED.code,
errorMessage: errors.ERROR_SERVICE_UPLOAD_FAILED.message
+ ": " + String(response.errorMessage)
});
}

View File

@ -204,10 +204,10 @@
"ERROR_USER_DUPLICATE" : { "code" : 1702, "message" : "duplicate user" },
"ERROR_USER_NOT_FOUND" : { "code" : 1703, "message" : "user not found" },
"ERROR_USER_CHANGE_PASSWORD" : { "code" : 1704, "message" : "user must change his password" },
"ERROR_APPLICATION_INVALID_NAME" : { "code" : 1750, "message" : "invalid application name" },
"ERROR_APPLICATION_INVALID_MOUNT" : { "code" : 1751, "message" : "invalid mount" },
"ERROR_APPLICATION_DOWNLOAD_FAILED" : { "code" : 1752, "message" : "application download failed" },
"ERROR_APPLICATION_UPLOAD_FAILED" : { "code" : 1753, "message" : "application upload failed" },
"ERROR_SERVICE_INVALID_NAME" : { "code" : 1750, "message" : "invalid application name" },
"ERROR_SERVICE_INVALID_MOUNT" : { "code" : 1751, "message" : "invalid mount" },
"ERROR_SERVICE_DOWNLOAD_FAILED" : { "code" : 1752, "message" : "application download failed" },
"ERROR_SERVICE_UPLOAD_FAILED" : { "code" : 1753, "message" : "application upload failed" },
"ERROR_KEYVALUE_INVALID_KEY" : { "code" : 1800, "message" : "invalid key declaration" },
"ERROR_KEYVALUE_KEY_EXISTS" : { "code" : 1801, "message" : "key already exists" },
"ERROR_KEYVALUE_KEY_NOT_FOUND" : { "code" : 1802, "message" : "key not found" },
@ -256,12 +256,12 @@
"SIMPLE_CLIENT_COULD_NOT_WRITE" : { "code" : 2002, "message" : "could not write to server" },
"SIMPLE_CLIENT_COULD_NOT_READ" : { "code" : 2003, "message" : "could not read from server" },
"ERROR_MALFORMED_MANIFEST_FILE" : { "code" : 3000, "message" : "malformed manifest file" },
"ERROR_INVALID_APPLICATION_MANIFEST" : { "code" : 3001, "message" : "manifest file is invalid" },
"ERROR_INVALID_SERVICE_MANIFEST" : { "code" : 3001, "message" : "manifest file is invalid" },
"ERROR_INVALID_FOXX_OPTIONS" : { "code" : 3004, "message" : "invalid foxx options" },
"ERROR_INVALID_MOUNTPOINT" : { "code" : 3007, "message" : "mountpoint is invalid" },
"ERROR_APP_NOT_FOUND" : { "code" : 3009, "message" : "Service not found" },
"ERROR_APP_NEEDS_CONFIGURATION" : { "code" : 3010, "message" : "Service not configured" },
"ERROR_APP_MOUNTPOINT_CONFLICT" : { "code" : 3011, "message" : "mountpoint already in use" },
"ERROR_SERVICE_NOT_FOUND" : { "code" : 3009, "message" : "Service not found" },
"ERROR_SERVICE_NEEDS_CONFIGURATION" : { "code" : 3010, "message" : "Service not configured" },
"ERROR_SERVICE_MOUNTPOINT_CONFLICT" : { "code" : 3011, "message" : "mountpoint already in use" },
"ERROR_MODULE_NOT_FOUND" : { "code" : 3100, "message" : "cannot locate module" },
"ERROR_MODULE_FAILURE" : { "code" : 3103, "message" : "failed to invoke module" },
"RESULT_ELEMENT_EXISTS" : { "code" : 10000, "message" : "element not inserted into structure, because it already exists" },

View File

@ -426,8 +426,8 @@ exports.stringPadding = function (str, len, pad, dir) {
exports.throwDownloadError = function (msg) {
throw new exports.ArangoError({
errorNum: exports.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.code,
errorMessage: exports.errors.ERROR_APPLICATION_DOWNLOAD_FAILED.message + ': ' + String(msg)
errorNum: exports.errors.ERROR_SERVICE_DOWNLOAD_FAILED.code,
errorMessage: exports.errors.ERROR_SERVICE_DOWNLOAD_FAILED.message + ': ' + String(msg)
});
};

View File

@ -252,8 +252,8 @@ function validateServiceName (name) {
}
throw new ArangoError({
errorNum: errors.ERROR_APPLICATION_INVALID_NAME.code,
errorMessage: errors.ERROR_APPLICATION_INVALID_NAME.message
errorNum: errors.ERROR_SERVICE_INVALID_NAME.code,
errorMessage: errors.ERROR_SERVICE_INVALID_NAME.message
});
}

View File

@ -89,7 +89,7 @@ describe('Foxx Manager install', function() {
expect(function () {
FoxxManager.install(fs.join(basePath, 'malformed-name'), '/unittest/broken');
}).to.throw(ArangoError)
.with.property('errorNum', errors.ERROR_INVALID_APPLICATION_MANIFEST.code);
.with.property('errorNum', errors.ERROR_INVALID_SERVICE_MANIFEST.code);
});
it('with malformed controller file', function() {

View File

@ -106,7 +106,7 @@ function resolveFoxx(req, res, appPath) {
try {
return FoxxManager.ensureRouted(appPath);
} catch (e) {
if (e instanceof ArangoError && e.errorNum === errors.ERROR_APP_NOT_FOUND.code) {
if (e instanceof ArangoError && e.errorNum === errors.ERROR_SERVICE_NOT_FOUND.code) {
resultNotFound(req, res, 404, e.errorMessage);
return;
}

View File

@ -242,9 +242,9 @@ function lookupService(mount) {
return serviceCache[dbname][mount];
}
throw new ArangoError({
errorNum: errors.ERROR_APP_NOT_FOUND.code,
errorNum: errors.ERROR_SERVICE_NOT_FOUND.code,
errorMessage: dd`
${errors.ERROR_APP_NOT_FOUND.message}
${errors.ERROR_SERVICE_NOT_FOUND.message}
Mount path: "${mount}".
`
});
@ -428,9 +428,9 @@ function checkManifest(filename, inputManifest, mount, isDevelopment) {
console.errorLines(error);
}
throw new ArangoError({
errorNum: errors.ERROR_INVALID_APPLICATION_MANIFEST.code,
errorNum: errors.ERROR_INVALID_SERVICE_MANIFEST.code,
errorMessage: dd`
${errors.ERROR_INVALID_APPLICATION_MANIFEST.message}
${errors.ERROR_INVALID_SERVICE_MANIFEST.message}
Manifest for service at "${mount}":
${errors.join('\n')}
`
@ -485,9 +485,9 @@ function validateManifestFile(filename, mount, isDevelopment) {
} catch (e) {
throw Object.assign(
new ArangoError({
errorNum: errors.ERROR_INVALID_APPLICATION_MANIFEST.code,
errorNum: errors.ERROR_INVALID_SERVICE_MANIFEST.code,
errorMessage: dd`
${errors.ERROR_INVALID_APPLICATION_MANIFEST.message}
${errors.ERROR_INVALID_SERVICE_MANIFEST.message}
File: ${filename}
Cause: ${e.stack}
`
@ -957,9 +957,9 @@ function _scanFoxx(mount, options, activateDevelopment) {
var old = utils.getStorage().firstExample({ mount: mount });
if (old === null) {
throw new ArangoError({
errorNum: errors.ERROR_APP_NOT_FOUND.code,
errorNum: errors.ERROR_SERVICE_NOT_FOUND.code,
errorMessage: dd`
${errors.ERROR_APP_NOT_FOUND.message}
${errors.ERROR_SERVICE_NOT_FOUND.message}
Mount path: "${mount}".
`
});
@ -1084,9 +1084,9 @@ function _install(serviceInfo, mount, options, runSetup) {
options = options || {};
if (fs.exists(targetPath)) {
throw new ArangoError({
errorNum: errors.ERROR_APP_MOUNTPOINT_CONFLICT.code,
errorNum: errors.ERROR_SERVICE_MOUNTPOINT_CONFLICT.code,
errorMessage: dd`
${errors.ERROR_APP_MOUNTPOINT_CONFLICT.message}
${errors.ERROR_SERVICE_MOUNTPOINT_CONFLICT.message}
Mount path: "${mount}".
`
});
@ -1600,8 +1600,8 @@ function requireService(mount) {
var service = lookupService(mount);
if (service.needsConfiguration()) {
throw new ArangoError({
errorNum: errors.ERROR_APP_NEEDS_CONFIGURATION.code,
errorMessage: errors.ERROR_APP_NEEDS_CONFIGURATION.message
errorNum: errors.ERROR_SERVICE_NEEDS_CONFIGURATION.code,
errorMessage: errors.ERROR_SERVICE_NEEDS_CONFIGURATION.message
});
}
return routeAndExportService(service, true).exports;

View File

@ -30,7 +30,7 @@ const errors = require('@arangodb').errors;
const FoxxManager = require('@arangodb/foxx/manager');
const swaggerJson = require('@arangodb/foxx/legacy/swagger').swaggerJson;
const NOT_FOUND = errors.ERROR_APP_NOT_FOUND.code;
const NOT_FOUND = errors.ERROR_SERVICE_NOT_FOUND.code;
const SWAGGER_ROOT = fs.join(internal.startupPath, 'server', 'assets', 'swagger');

View File

@ -275,10 +275,10 @@ ERROR_USER_CHANGE_PASSWORD,1704,"user must change his password","Will be raised
## Service management errors
################################################################################
ERROR_APPLICATION_INVALID_NAME,1750,"invalid service name","Will be raised when an invalid service name is specified."
ERROR_APPLICATION_INVALID_MOUNT,1751,"invalid mount","Will be raised when an invalid mount is specified."
ERROR_APPLICATION_DOWNLOAD_FAILED,1752,"service download failed","Will be raised when a service download from the central repository failed."
ERROR_APPLICATION_UPLOAD_FAILED,1753,"service upload failed","Will be raised when a service upload from the client to the ArangoDB server failed."
ERROR_SERVICE_INVALID_NAME,1750,"invalid service name","Will be raised when an invalid service name is specified."
ERROR_SERVICE_INVALID_MOUNT,1751,"invalid mount","Will be raised when an invalid mount is specified."
ERROR_SERVICE_DOWNLOAD_FAILED,1752,"service download failed","Will be raised when a service download from the central repository failed."
ERROR_SERVICE_UPLOAD_FAILED,1753,"service upload failed","Will be raised when a service upload from the client to the ArangoDB server failed."
################################################################################
## Key value access errors
@ -357,12 +357,12 @@ SIMPLE_CLIENT_COULD_NOT_READ,2003,"could not read from server","Will be raised w
################################################################################
ERROR_MALFORMED_MANIFEST_FILE,3000,"malformed manifest file","The manifest file is malformed. It is not in a valid JSON format."
ERROR_INVALID_APPLICATION_MANIFEST,3001,"manifest file is invalid","The manifest file of this application is invalid."
ERROR_INVALID_SERVICE_MANIFEST,3001,"manifest file is invalid","The manifest file of this service is invalid."
ERROR_INVALID_FOXX_OPTIONS,3004,"invalid foxx options","The options used to configure the foxx are invalid."
ERROR_INVALID_MOUNTPOINT,3007,"mountpoint is invalid","mountpoint is invalid"
ERROR_APP_NOT_FOUND,3009,"Service not found","No service found at this mountpoint"
ERROR_APP_NEEDS_CONFIGURATION,3010,"Service not configured","The service has to be configured before it can be used"
ERROR_APP_MOUNTPOINT_CONFLICT,3011,"mountpoint already in use","A service has already been installed at this mountpoint"
ERROR_SERVICE_NOT_FOUND,3009,"Service not found","No service found at this mountpoint"
ERROR_SERVICE_NEEDS_CONFIGURATION,3010,"Service not configured","The service has to be configured before it can be used"
ERROR_SERVICE_MOUNTPOINT_CONFLICT,3011,"mountpoint already in use","A service has already been installed at this mountpoint"
################################################################################
## JavaScript module loader errors

View File

@ -200,10 +200,10 @@ void TRI_InitializeErrorMessages () {
REG_ERROR(ERROR_USER_DUPLICATE, "duplicate user");
REG_ERROR(ERROR_USER_NOT_FOUND, "user not found");
REG_ERROR(ERROR_USER_CHANGE_PASSWORD, "user must change his password");
REG_ERROR(ERROR_APPLICATION_INVALID_NAME, "invalid application name");
REG_ERROR(ERROR_APPLICATION_INVALID_MOUNT, "invalid mount");
REG_ERROR(ERROR_APPLICATION_DOWNLOAD_FAILED, "application download failed");
REG_ERROR(ERROR_APPLICATION_UPLOAD_FAILED, "application upload failed");
REG_ERROR(ERROR_SERVICE_INVALID_NAME, "invalid application name");
REG_ERROR(ERROR_SERVICE_INVALID_MOUNT, "invalid mount");
REG_ERROR(ERROR_SERVICE_DOWNLOAD_FAILED, "application download failed");
REG_ERROR(ERROR_SERVICE_UPLOAD_FAILED, "application upload failed");
REG_ERROR(ERROR_KEYVALUE_INVALID_KEY, "invalid key declaration");
REG_ERROR(ERROR_KEYVALUE_KEY_EXISTS, "key already exists");
REG_ERROR(ERROR_KEYVALUE_KEY_NOT_FOUND, "key not found");
@ -252,12 +252,12 @@ void TRI_InitializeErrorMessages () {
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_WRITE, "could not write to server");
REG_ERROR(SIMPLE_CLIENT_COULD_NOT_READ, "could not read from server");
REG_ERROR(ERROR_MALFORMED_MANIFEST_FILE, "malformed manifest file");
REG_ERROR(ERROR_INVALID_APPLICATION_MANIFEST, "manifest file is invalid");
REG_ERROR(ERROR_INVALID_SERVICE_MANIFEST, "manifest file is invalid");
REG_ERROR(ERROR_INVALID_FOXX_OPTIONS, "invalid foxx options");
REG_ERROR(ERROR_INVALID_MOUNTPOINT, "mountpoint is invalid");
REG_ERROR(ERROR_APP_NOT_FOUND, "Service not found");
REG_ERROR(ERROR_APP_NEEDS_CONFIGURATION, "Service not configured");
REG_ERROR(ERROR_APP_MOUNTPOINT_CONFLICT, "mountpoint already in use");
REG_ERROR(ERROR_SERVICE_NOT_FOUND, "Service not found");
REG_ERROR(ERROR_SERVICE_NEEDS_CONFIGURATION, "Service not configured");
REG_ERROR(ERROR_SERVICE_MOUNTPOINT_CONFLICT, "mountpoint already in use");
REG_ERROR(ERROR_MODULE_NOT_FOUND, "cannot locate module");
REG_ERROR(ERROR_MODULE_FAILURE, "failed to invoke module");
REG_ERROR(RESULT_ELEMENT_EXISTS, "element not inserted into structure, because it already exists");

View File

@ -2672,27 +2672,27 @@ void TRI_InitializeErrorMessages ();
#define TRI_ERROR_USER_CHANGE_PASSWORD (1704)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1750: ERROR_APPLICATION_INVALID_NAME
/// @brief 1750: ERROR_SERVICE_INVALID_NAME
///
/// invalid application name
///
/// Will be raised when an invalid application name is specified.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APPLICATION_INVALID_NAME (1750)
#define TRI_ERROR_SERVICE_INVALID_NAME (1750)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1751: ERROR_APPLICATION_INVALID_MOUNT
/// @brief 1751: ERROR_SERVICE_INVALID_MOUNT
///
/// invalid mount
///
/// Will be raised when an invalid mount is specified.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APPLICATION_INVALID_MOUNT (1751)
#define TRI_ERROR_SERVICE_INVALID_MOUNT (1751)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1752: ERROR_APPLICATION_DOWNLOAD_FAILED
/// @brief 1752: ERROR_SERVICE_DOWNLOAD_FAILED
///
/// application download failed
///
@ -2700,10 +2700,10 @@ void TRI_InitializeErrorMessages ();
/// failed.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APPLICATION_DOWNLOAD_FAILED (1752)
#define TRI_ERROR_SERVICE_DOWNLOAD_FAILED (1752)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1753: ERROR_APPLICATION_UPLOAD_FAILED
/// @brief 1753: ERROR_SERVICE_UPLOAD_FAILED
///
/// application upload failed
///
@ -2711,7 +2711,7 @@ void TRI_InitializeErrorMessages ();
/// server failed.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APPLICATION_UPLOAD_FAILED (1753)
#define TRI_ERROR_SERVICE_UPLOAD_FAILED (1753)
////////////////////////////////////////////////////////////////////////////////
/// @brief 1800: ERROR_KEYVALUE_INVALID_KEY
@ -3196,14 +3196,14 @@ void TRI_InitializeErrorMessages ();
#define TRI_ERROR_MALFORMED_MANIFEST_FILE (3000)
////////////////////////////////////////////////////////////////////////////////
/// @brief 3001: ERROR_INVALID_APPLICATION_MANIFEST
/// @brief 3001: ERROR_INVALID_SERVICE_MANIFEST
///
/// manifest file is invalid
///
/// The manifest file of this application is invalid.
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_INVALID_APPLICATION_MANIFEST (3001)
#define TRI_ERROR_INVALID_SERVICE_MANIFEST (3001)
////////////////////////////////////////////////////////////////////////////////
/// @brief 3004: ERROR_INVALID_FOXX_OPTIONS
@ -3226,34 +3226,34 @@ void TRI_InitializeErrorMessages ();
#define TRI_ERROR_INVALID_MOUNTPOINT (3007)
////////////////////////////////////////////////////////////////////////////////
/// @brief 3009: ERROR_APP_NOT_FOUND
/// @brief 3009: ERROR_SERVICE_NOT_FOUND
///
/// Service not found
///
/// No service found at this mountpoint
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APP_NOT_FOUND (3009)
#define TRI_ERROR_SERVICE_NOT_FOUND (3009)
////////////////////////////////////////////////////////////////////////////////
/// @brief 3010: ERROR_APP_NEEDS_CONFIGURATION
/// @brief 3010: ERROR_SERVICE_NEEDS_CONFIGURATION
///
/// Service not configured
///
/// The service has to be configured before it can be used
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APP_NEEDS_CONFIGURATION (3010)
#define TRI_ERROR_SERVICE_NEEDS_CONFIGURATION (3010)
////////////////////////////////////////////////////////////////////////////////
/// @brief 3011: ERROR_APP_MOUNTPOINT_CONFLICT
/// @brief 3011: ERROR_SERVICE_MOUNTPOINT_CONFLICT
///
/// mountpoint already in use
///
/// A service has already been installed at this mountpoint
////////////////////////////////////////////////////////////////////////////////
#define TRI_ERROR_APP_MOUNTPOINT_CONFLICT (3011)
#define TRI_ERROR_SERVICE_MOUNTPOINT_CONFLICT (3011)
////////////////////////////////////////////////////////////////////////////////
/// @brief 3100: ERROR_MODULE_NOT_FOUND