From fd50d3d33ccf72269dd5c9c8aeea06a000975099 Mon Sep 17 00:00:00 2001 From: Sebastian Leidig Date: Tue, 2 Jul 2024 11:29:02 +0200 Subject: [PATCH] fix(logging): log DISPLAY_ENTITY and ENTITY_SELECT not_found in more general way --- .../entity/entity-block/entity-block.component.spec.ts | 4 +++- .../entity/entity-block/entity-block.component.ts | 4 +++- .../entity-select/entity-select.component.spec.ts | 4 +++- .../entity-select/entity-select.component.ts | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.spec.ts b/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.spec.ts index e8af30cfb5..0ceb8afb17 100644 --- a/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.spec.ts +++ b/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.spec.ts @@ -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(); }); diff --git a/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.ts b/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.ts index 62b8de0f15..290ec6b794 100644 --- a/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.ts +++ b/src/app/core/basic-datatypes/entity/entity-block/entity-block.component.ts @@ -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, ); } } diff --git a/src/app/core/common-components/entity-select/entity-select.component.spec.ts b/src/app/core/common-components/entity-select/entity-select.component.spec.ts index f973a1ddd0..8579a255e9 100644 --- a/src/app/core/common-components/entity-select/entity-select.component.spec.ts +++ b/src/app/core/common-components/entity-select/entity-select.component.spec.ts @@ -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()]); })); diff --git a/src/app/core/common-components/entity-select/entity-select.component.ts b/src/app/core/common-components/entity-select/entity-select.component.ts index abb4d0d7d5..8c1433e200 100644 --- a/src/app/core/common-components/entity-select/entity-select.component.ts +++ b/src/app/core/common-components/entity-select/entity-select.component.ts @@ -201,7 +201,9 @@ export class EntitySelectComponent< .load(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; });