Skip to content

Commit

Permalink
Extend WebDavClientError from AxiosError
Browse files Browse the repository at this point in the history
  • Loading branch information
dpakach committed May 13, 2021
1 parent 124ba8b commit 7d25d24
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 4 deletions.
1 change: 0 additions & 1 deletion source/response.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import {AxiosResponse} from "axios";

export function handleResponseCode(context: WebDAVClientContext, response: Response): Response {
const status = response.status;

if (status === 401 && context.digest) return response;
if (status >= 400) {
const err: WebDAVClientError = new Error(`Invalid response: ${status} ${response.statusText}`) as WebDAVClientError;
Expand Down
5 changes: 2 additions & 3 deletions source/types.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import Stream from "stream";
import {AxiosResponse} from "axios";
import {AxiosError} from "axios";

export type AuthHeader = string;

Expand Down Expand Up @@ -230,9 +230,8 @@ export interface WebDAVClientContext {
withCredentials?: boolean;
}

export interface WebDAVClientError extends Error {
export interface WebDAVClientError extends AxiosError {
status?: number;
response?: AxiosResponse;
}

export interface WebDAVClientOptions {
Expand Down

0 comments on commit 7d25d24

Please sign in to comment.