Skip to content

Commit

Permalink
Merge pull request #363 from mollie/pimm/api-error-cleanup
Browse files Browse the repository at this point in the history
Cleanup ApiError.
  • Loading branch information
Pimm authored Sep 10, 2024
2 parents a8d0ed2 + 734f57f commit b3cfbff
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 32 deletions.
30 changes: 0 additions & 30 deletions src/errors/ApiError.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,36 +27,6 @@ export default class ApiError extends Error {
Object.defineProperty(this, 'message', { enumerable: true });
}

/**
* Get the error message
*
* @since 3.0.0
* @deprecated Use `error.message` instead.
*/
public getMessage(): string {
return this.message;
}

/**
* Get the field name that contains an error
*
* @since 3.0.0
* @deprecated Use `error.field` instead.
*/
public getField(): Maybe<string> {
return this.field;
}

/**
* Get the API status code
*
* @since 3.0.0
* @deprecated Use `error.statusCode` instead.
*/
public getStatusCode(): Maybe<number> {
return this.statusCode;
}

/**
* Get the documentation URL
*
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/resources/methods.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ describe('methods', () => {
})
.catch(err => {
expect(err).toBeInstanceOf(ApiError);
expect(err.getMessage()).toEqual(error.detail);
expect(err.message).toEqual(error.detail);
});
});
});
Expand All @@ -57,7 +57,7 @@ describe('methods', () => {
return new Promise<void>(resolve => {
methods.get('foo', {}, (err: any, result) => {
expect(err).toBeInstanceOf(ApiError);
expect(err.getMessage()).toEqual(error.detail);
expect(err.message).toEqual(error.detail);
expect(result).toBeUndefined();
resolve();
});
Expand Down

0 comments on commit b3cfbff

Please sign in to comment.