Skip to content
This repository was archived by the owner on Mar 13, 2025. It is now read-only.

Commit 9116664

Browse files
committed
fix exception
1 parent 740d8f3 commit 9116664

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

src/errors/gql.error.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,17 @@ export class GQLError extends BaseError {
3333
details.path = this.gql.path;
3434
details.extensions = this.gql.extensions;
3535

36-
details.extensions.exception = details.extensions.exception || {};
37-
details.extensions.exception.type = this.type;
38-
details.extensions.exception.message = this.message;
39-
40-
if (this.previous && this.previous instanceof BaseError) {
41-
details.extensions.exception.previous = this.previous.render();
42-
} else if (this.previous && this.previous.message) {
43-
details.extensions.exception.previous = this.previous.message;
36+
if (details.extensions) {
37+
details.extensions.exception = details.extensions.exception || {};
38+
details.extensions.exception.type = this.type;
39+
details.extensions.exception.message = this.message;
40+
41+
if (this.previous && this.previous instanceof BaseError) {
42+
details.extensions.exception.previous = this.previous.render();
43+
} else if (this.previous && this.previous.message) {
44+
details.extensions.exception.previous = this.previous.message;
45+
}
4446
}
45-
4647
return details;
4748
}
4849
}

0 commit comments

Comments
 (0)