Skip to content
Snippets Groups Projects
Commit d8843c57 authored by Bekerle, Patrizio's avatar Bekerle, Patrizio :fire: Committed by Reiter, Christoph
Browse files

Add more error handling

parent 188df0fe
No related branches found
No related tags found
No related merge requests found
......@@ -134,11 +134,23 @@ export default class JSONLD {
}
getApiUrlForIdentifier(identifier) {
return this.getEntityForIdentifier(identifier)["@entryPoint"];
const entity = this.getEntityForIdentifier(identifier);
if (entity === undefined || entity["@entryPoint"] === undefined) {
throw new Error(`Entity with identifier "${identifier}" not found!`);
}
return entity["@entryPoint"];
}
getApiUrlForEntityName(entityName) {
return this.getEntityForEntityName(entityName)["@entryPoint"];
const entity = this.getEntityForEntityName(entityName);
if (entity === undefined || entity["@entryPoint"] === undefined) {
throw new Error(`Entity "${entityName}" not found!`);
}
return entity["@entryPoint"];
}
getEntityNameForIdentifier(identifier) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment