Skip to content

Commit

Permalink
refactor: rename
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Oct 27, 2022
1 parent f1b7af3 commit d700bdb
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/error.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ export class FetchError<T = any> extends Error {
request?: FetchRequest
response?: FetchResponse<T>
data?: T
statusCode?: number
statusMessage?: string
status?: number
statusText?: string
}

export function createFetchError<T = any> (request: FetchRequest, error?: Error, response?: FetchResponse<T>): FetchError<T> {
Expand All @@ -23,8 +23,8 @@ export function createFetchError<T = any> (request: FetchRequest, error?: Error,
Object.defineProperty(fetchError, 'request', { get () { return request } })
Object.defineProperty(fetchError, 'response', { get () { return response } })
Object.defineProperty(fetchError, 'data', { get () { return response && response._data } })
Object.defineProperty(fetchError, 'statusCode', { get () { return response && response.status } })
Object.defineProperty(fetchError, 'statusMessage', { get () { return response && response.statusText } })
Object.defineProperty(fetchError, 'status', { get () { return response && response.status } })
Object.defineProperty(fetchError, 'statusText', { get () { return response && response.statusText } })

return fetchError
}

0 comments on commit d700bdb

Please sign in to comment.