Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup ApiError #363

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading