Skip to content

Commit

Permalink
fix(errors): fix leaking resolver source code in message
Browse files Browse the repository at this point in the history
  • Loading branch information
MichalLytek committed Dec 21, 2019
1 parent 2a39116 commit 26ee0ce
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 3 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# Changelog and release notes

<!-- ## Unreleased -->
## Unreleased
<!-- here goes all the unreleased changes descriptions -->
### Fixes
- fix leaking resolver source code in `MissingSubscriptionTopicsError` error message (#489)

## v0.17.5
### Features
Expand Down
2 changes: 1 addition & 1 deletion src/errors/MissingSubscriptionTopicsError.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export class MissingSubscriptionTopicsError extends Error {
constructor(target: Function, methodName: string) {
super(`${target}#${methodName} subscription has no provided topics!`);
super(`${target.name}#${methodName} subscription has no provided topics!`);

Object.setPrototypeOf(this, new.target.prototype);
}
Expand Down
3 changes: 2 additions & 1 deletion tests/functional/subscriptions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -535,7 +535,7 @@ describe("Subscriptions", () => {

it("should throw error while passing empty topics array to Subscription", async () => {
getMetadataStorage().clear();
expect.assertions(4);
expect.assertions(5);
try {
@ObjectType()
class SampleObject {
Expand Down Expand Up @@ -569,6 +569,7 @@ describe("Subscriptions", () => {
expect(err).toBeInstanceOf(MissingSubscriptionTopicsError);
expect(err.message).toContain("SampleResolver");
expect(err.message).toContain("sampleSubscription");
expect(err.message).not.toContain("class SampleResolver");
}
});

Expand Down

0 comments on commit 26ee0ce

Please sign in to comment.