mirror of https://gitee.com/bigwinds/arangodb
Setup and teardown of foxx apps and foxx dev apps should now print their errors properly
This commit is contained in:
parent
4b49179b0e
commit
ac1d0e37c1
|
@ -171,8 +171,8 @@ function checkManifest (filename, mf) {
|
||||||
|
|
||||||
if (failed) {
|
if (failed) {
|
||||||
throw new ArangoError({
|
throw new ArangoError({
|
||||||
errorNum: errors.MANIFEST_FILE_ATTRIBUTE_MISSING.code,
|
errorNum: errors.ERROR_MANIFEST_FILE_ATTRIBUTE_MISSING.code,
|
||||||
errorMessage: errors.MANIFEST_FILE_ATTRIBUTE_MISSING.message
|
errorMessage: errors.ERROR_MANIFEST_FILE_ATTRIBUTE_MISSING.message
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1596,47 +1596,21 @@ exports.developmentRoutes = function () {
|
||||||
|
|
||||||
for (j = 0; j < files.length; ++j) {
|
for (j = 0; j < files.length; ++j) {
|
||||||
m = fs.join(root, files[j], "manifest.json");
|
m = fs.join(root, files[j], "manifest.json");
|
||||||
|
mf = validateManifestFile(m);
|
||||||
|
if (mf !== undefined) {
|
||||||
|
|
||||||
if (fs.exists(m)) {
|
|
||||||
try {
|
|
||||||
mf = JSON.parse(fs.read(m));
|
|
||||||
} catch (err) {
|
|
||||||
console.errorLines(
|
|
||||||
"Cannot parse app manifest '%s': %s", m, String(err));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
checkManifest(m, mf);
|
|
||||||
} catch (err) {
|
|
||||||
console.errorLines(
|
|
||||||
"Manifest file '%s' invalid: %s", m, String(err));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
appId = "dev:" + mf.name + ":" + files[j];
|
appId = "dev:" + mf.name + ":" + files[j];
|
||||||
mount = "/dev/" + files[j];
|
mount = "/dev/" + files[j];
|
||||||
options = {
|
options = {
|
||||||
collectionPrefix : prefixFromMount(mount)
|
collectionPrefix : prefixFromMount(mount)
|
||||||
};
|
};
|
||||||
|
app = createApp(appId, options, mf.name, m);
|
||||||
|
if (app !== undefined) {
|
||||||
try {
|
try {
|
||||||
app = module.createApp(appId, options);
|
|
||||||
} catch (err) {
|
|
||||||
console.errorLines(
|
|
||||||
"Failed to create App '%s' with manifest '%s': %s", mf.name, m, String(err));
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
if (app === null) {
|
|
||||||
console.errorLines(
|
|
||||||
"Cannot find application '%s'", appId);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
// TODO check
|
|
||||||
setupApp(app, mount, options.collectionPrefix);
|
setupApp(app, mount, options.collectionPrefix);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.errorLines(
|
console.errorLines(
|
||||||
"Setup of App '%s' with manifest '%s' failed: %s", m, String(err));
|
"Setup of App '%s' with manifest '%s' failed: %s", mf.name, m, String(err));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1672,6 +1646,7 @@ exports.developmentRoutes = function () {
|
||||||
mounts.push(desc);
|
mounts.push(desc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DEVELOPMENTMOUNTS = mounts;
|
DEVELOPMENTMOUNTS = mounts;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue