Permalink
Browse files

`@phenomic/core`: Improve error message from database not found entry

  • Loading branch information...
MoOx committed May 2, 2018
1 parent c79b572 commit fc729aa0dee61d2fc81b5b294f583f705bf40bf6
@@ -115,4 +115,4 @@ Object {
}
`;
exports[`db should throw when value isn't there 1`] = `[NotFoundError: ID not found in database]`;
exports[`db should throw when value isn't there 1`] = `[NotFoundError: ID 'baz' not found in database ('error')]`;
@@ -140,7 +140,9 @@ const db = {
): PhenomicDBEntryDetailed {
const item = getSublevel(sub).find(item => item.id === id);
if (typeof item === "undefined") {
throw new NotFoundError("ID not found in database");
throw new NotFoundError(
`ID '${id}' not found in database ('${String(sub)}')`
);
}
const { body, ...metadata } = item.data;
const relatedData = getDataRelations(metadata);

0 comments on commit fc729aa

Please sign in to comment.