Skip to content
This repository has been archived by the owner on Sep 7, 2020. It is now read-only.

Commit

Permalink
@phenomic/core: Improve error message from database not found entry
Browse files Browse the repository at this point in the history
  • Loading branch information
MoOx committed May 2, 2018
1 parent c79b572 commit fc729aa
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Expand Up @@ -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')]`;
4 changes: 3 additions & 1 deletion packages/core/src/db/index.js
Expand Up @@ -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);
Expand Down

0 comments on commit fc729aa

Please sign in to comment.