Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
fix: is*Error type definitions
Browse files Browse the repository at this point in the history
They should accept any type of AjaxError and not the specific type they
check for as this doesn't make sense
  • Loading branch information
boris-petrov authored and alexlafroscia committed Oct 9, 2018
1 parent fe518dc commit 101c357
Showing 1 changed file with 9 additions and 11 deletions.
20 changes: 9 additions & 11 deletions addon/errors.ts
Expand Up @@ -87,9 +87,7 @@ export function isAjaxError(error: any): error is AjaxError {
* Checks if the given status code or AjaxError object represents an
* unauthorized request error
*/
export function isUnauthorizedError(
error: UnauthorizedError | number
): boolean {
export function isUnauthorizedError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof UnauthorizedError;
} else {
Expand All @@ -101,7 +99,7 @@ export function isUnauthorizedError(
* Checks if the given status code or AjaxError object represents a forbidden
* request error
*/
export function isForbiddenError(error: ForbiddenError | number): boolean {
export function isForbiddenError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof ForbiddenError;
} else {
Expand All @@ -113,7 +111,7 @@ export function isForbiddenError(error: ForbiddenError | number): boolean {
* Checks if the given status code or AjaxError object represents an invalid
* request error
*/
export function isInvalidError(error: InvalidError | number): boolean {
export function isInvalidError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof InvalidError;
} else {
Expand All @@ -125,7 +123,7 @@ export function isInvalidError(error: InvalidError | number): boolean {
* Checks if the given status code or AjaxError object represents a bad request
* error
*/
export function isBadRequestError(error: BadRequestError | number): boolean {
export function isBadRequestError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof BadRequestError;
} else {
Expand All @@ -137,7 +135,7 @@ export function isBadRequestError(error: BadRequestError | number): boolean {
* Checks if the given status code or AjaxError object represents a "not found"
* error
*/
export function isNotFoundError(error: NotFoundError | number): boolean {
export function isNotFoundError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof NotFoundError;
} else {
Expand All @@ -149,7 +147,7 @@ export function isNotFoundError(error: NotFoundError | number): boolean {
* Checks if the given status code or AjaxError object represents a "gone"
* error
*/
export function isGoneError(error: GoneError | number): boolean {
export function isGoneError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof GoneError;
} else {
Expand All @@ -168,7 +166,7 @@ export function isTimeoutError(error: any) {
* Checks if the given status code or AjaxError object represents an
* "abort" error
*/
export function isAbortError(error: AbortError | number): boolean {
export function isAbortError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof AbortError;
} else {
Expand All @@ -180,7 +178,7 @@ export function isAbortError(error: AbortError | number): boolean {
* Checks if the given status code or AjaxError object represents a
* conflict error
*/
export function isConflictError(error: ConflictError | number): boolean {
export function isConflictError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof ConflictError;
} else {
Expand All @@ -191,7 +189,7 @@ export function isConflictError(error: ConflictError | number): boolean {
/**
* Checks if the given status code or AjaxError object represents a server error
*/
export function isServerError(error: ServerError | number): boolean {
export function isServerError(error: AjaxError | number): boolean {
if (isAjaxError(error)) {
return error instanceof ServerError;
} else {
Expand Down

0 comments on commit 101c357

Please sign in to comment.