Skip to content

Commit

Permalink
chore(error): improve error message and context for DocumentGetElemen…
Browse files Browse the repository at this point in the history
…tByIdError (#1088)

Reducing the amount of data in the message string. Improving context
with `id` and `doc`.

Relates to Instawork/mobile#7084

[Asana](https://app.asana.com/0/1204008699308084/1209425378622147)
  • Loading branch information
hgray-instawork authored Feb 18, 2025
1 parent 53f6499 commit c68b62f
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/services/dom/errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -71,13 +71,11 @@ export class DocumentGetElementByIdError extends ErrorService.HvBaseError {
name = 'DocumentGetElementByIdError';

constructor(id: string, doc: Document, error: Error) {
super(
`Document.getElementById failed for id: ${id} on doc: ${docToString(
doc,
)} and error: ${error.message}`,
);
super(`Document.getElementById failed for id: ${id}`);
this.stack = error.stack;
this.setExtraContext('error', error);
this.setExtraContext('doc', docToString(doc));
this.setExtraContext('id', id);
}
}

Expand Down

0 comments on commit c68b62f

Please sign in to comment.