Skip to content

Commit

Permalink
fix: catch potential errors when working with broken IDs
Browse files Browse the repository at this point in the history
  • Loading branch information
sleidig committed Oct 2, 2024
1 parent b49fa12 commit acae4a1
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions src/app/core/entity/model/entity.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import {
import { IconName } from "@fortawesome/fontawesome-svg-core";
import { UpdateMetadata } from "./update-metadata";
import { EntityBlockConfig } from "../../basic-datatypes/entity/entity-block/entity-block-config";
import { Logging } from "../../logging/logging.service";

/**
* This represents a static class of type <T>.
Expand Down Expand Up @@ -149,8 +150,14 @@ export class Entity {
* @param id An entity's id including prefix.
*/
static extractEntityIdFromId(id: string): string {
const split = id.indexOf(":");
return id.substring(split + 1);
let type: string = undefined;
try {
const split = id.indexOf(":");
type = id.substring(split + 1);
} catch (e) {
Logging.debug("Error extracting entityId from id", id, e);
}
return type;
}

/**
Expand Down

0 comments on commit acae4a1

Please sign in to comment.