change: Clarify parent error message.

This commit is contained in:
Ruben Verborgh 2020-12-01 20:10:53 +01:00
parent 535cbcd93a
commit 357546e90f
2 changed files with 3 additions and 2 deletions

View File

@ -53,7 +53,7 @@ export const getParentContainer = (id: ResourceIdentifier): ResourceIdentifier =
// This probably means there is an issue with the root
if (parentPath === id.path) {
throw new InternalServerError('URL root reached');
throw new InternalServerError(`Resource ${id.path} does not have a parent container`);
}
return { path: parentPath };

View File

@ -37,7 +37,8 @@ describe('PathUtil', (): void => {
});
it('errors when the root of an URl is reached that does not match the input root.', async(): Promise<void> => {
expect((): any => getParentContainer({ path: 'http://test.com/' })).toThrow('URL root reached');
expect((): any => getParentContainer({ path: 'http://test.com/' }))
.toThrow('Resource http://test.com/ does not have a parent container');
});
});
});