0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-20 22:42:53 -05:00

Fix DB API

no ref
- Use correct error type
This commit is contained in:
Fabian Becker 2014-09-27 19:05:35 +00:00
parent 24a7739e8a
commit 72b0a48483

View file

@ -45,7 +45,7 @@ db = {
return Promise.reject(new errors.InternalServerError(error.message || error)); return Promise.reject(new errors.InternalServerError(error.message || error));
}); });
}, function () { }, function () {
return Promise.reject(new errors.NoPermissionError('You do not have permission to export data. (no rights)')); return Promise.reject(new errors.NoPermissionError('You do not have permission to export data (no rights).'));
}); });
}, },
/** /**
@ -101,7 +101,7 @@ db = {
} }
} catch (e) { } catch (e) {
errors.logError(e, 'API DB import content', 'check that the import file is valid JSON.'); errors.logError(e, 'API DB import content', 'check that the import file is valid JSON.');
return Promise.reject(new errors.BadRequest('Failed to parse the import JSON file')); return Promise.reject(new errors.BadRequestError('Failed to parse the import JSON file.'));
} }
if (!importData.meta || !importData.meta.version) { if (!importData.meta || !importData.meta.version) {
@ -119,7 +119,7 @@ db = {
return Promise.promisify(fs.unlink)(filepath); return Promise.promisify(fs.unlink)(filepath);
}); });
}, function () { }, function () {
return Promise.reject(new errors.NoPermissionError('You do not have permission to import data. (no rights)')); return Promise.reject(new errors.NoPermissionError('You do not have permission to import data (no rights).'));
}); });
}, },
/** /**
@ -140,7 +140,7 @@ db = {
return Promise.reject(new errors.InternalServerError(error.message || error)); return Promise.reject(new errors.InternalServerError(error.message || error));
}); });
}, function () { }, function () {
return Promise.reject(new errors.NoPermissionError('You do not have permission to export data. (no rights)')); return Promise.reject(new errors.NoPermissionError('You do not have permission to export data (no rights).'));
}); });
} }
}; };