Skip to content

Commit

Permalink
fix(logging): log DISPLAY_ENTITY and ENTITY_SELECT not_found in more …
Browse files Browse the repository at this point in the history
…general way
  • Loading branch information
sleidig committed Jul 2, 2024
1 parent f7b48f5 commit fd50d3d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,9 @@ describe("DisplayEntityComponent", () => {
await component.ngOnInit();

expect(logSpy).toHaveBeenCalledWith(
jasmine.stringContaining(child.getId()),
jasmine.stringContaining("Could not find entity"),
child.getId(),
jasmine.anything(),
);
expect(component.entityToDisplay).toBeUndefined();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ export class EntityBlockComponent implements OnInit {
} catch (e) {
// this may be caused by restrictive permissions and therefore shouldn't be treated as a technical issue
this.logger.debug(
`[DISPLAY_ENTITY] Could not find entity with ID: ${this.entityId}: ${e}`,
"[DISPLAY_ENTITY] Could not find entity.",
this.entityId,
e,
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,9 @@ describe("EntitySelectComponent", () => {
fixture.detectChanges();

expect(warnSpy).toHaveBeenCalledWith(
jasmine.stringContaining("missing_user"),
jasmine.stringContaining("ENTITY_SELECT"),
"missing_user",
jasmine.anything(),
);
expect(component.form.value).toEqual([testUsers[0].getId()]);
}));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,9 @@ export class EntitySelectComponent<
.load<E>(type, selectedId)
.catch((err: Error) => {
this.logger.warn(
`[ENTITY_SELECT] Error loading selected entity "${selectedId}": ${err.message}`,
"[ENTITY_SELECT] Error loading selected entity.",
selectedId,
err.message,
);
return undefined;
});
Expand Down

0 comments on commit fd50d3d

Please sign in to comment.