@aurelia/fetch-client
Advanced tools
Comparing version 2.0.1-dev.202405110109 to 2.0.1-dev.202405230048
@@ -6,2 +6,9 @@ # Change Log | ||
<a name="2.0.0-beta.18"></a> | ||
# 2.0.0-beta.18 (2024-05-23) | ||
### Refactorings: | ||
* ***:** extract error codes and cleanup (#1974) ([63ffdc9](https://github.com/aurelia/aurelia/commit/63ffdc9)) | ||
<a name="2.0.0-beta.17"></a> | ||
@@ -8,0 +15,0 @@ # 2.0.0-beta.17 (2024-05-11) |
{ | ||
"name": "@aurelia/fetch-client", | ||
"version": "2.0.1-dev.202405110109", | ||
"version": "2.0.1-dev.202405230048", | ||
"main": "dist/cjs/index.cjs", | ||
@@ -57,4 +57,4 @@ "module": "dist/esm/index.mjs", | ||
"dependencies": { | ||
"@aurelia/kernel": "2.0.1-dev.202405110109", | ||
"@aurelia/metadata": "2.0.1-dev.202405110109" | ||
"@aurelia/kernel": "2.0.1-dev.202405230048", | ||
"@aurelia/metadata": "2.0.1-dev.202405230048" | ||
}, | ||
@@ -61,0 +61,0 @@ "devDependencies": { |
@@ -5,2 +5,3 @@ import { DI, IIndexable, factory, resolve } from '@aurelia/kernel'; | ||
import { RetryInterceptor } from './interceptors'; | ||
import { ErrorNames, createMappedError } from './errors'; | ||
@@ -15,3 +16,3 @@ const absoluteUrlRegexp = /^([a-z][a-z0-9+\-.]*:)?\/\//i; | ||
if (typeof fetch !== 'function') { | ||
throw new Error('Could not resolve fetch function. Please provide a fetch function implementation or a polyfill for the global fetch function.'); | ||
throw createMappedError(ErrorNames.http_client_fetch_fn_not_found); | ||
} | ||
@@ -100,7 +101,7 @@ return x.instance(fetch); | ||
} else { | ||
throw new Error(`The config callback did not return a valid HttpClientConfiguration like instance. Received ${typeof c}`); | ||
throw createMappedError(ErrorNames.http_client_configure_invalid_return, typeof c); | ||
} | ||
} | ||
} else { | ||
throw new Error(`invalid config, expecting a function or an object, received ${typeof config}`); | ||
throw createMappedError(ErrorNames.http_client_configure_invalid_config, typeof config); | ||
} | ||
@@ -113,3 +114,3 @@ | ||
// extract throwing error into an utility function | ||
throw new Error('Default headers must be a plain object.'); | ||
throw createMappedError(ErrorNames.http_client_configure_invalid_header); | ||
} | ||
@@ -121,3 +122,3 @@ | ||
if (interceptors.filter(x => x instanceof RetryInterceptor).length > 1) { | ||
throw new Error('Only one RetryInterceptor is allowed.'); | ||
throw createMappedError(ErrorNames.http_client_more_than_one_retry_interceptor); | ||
} | ||
@@ -128,3 +129,3 @@ | ||
if (retryInterceptorIndex >= 0 && retryInterceptorIndex !== interceptors.length - 1) { | ||
throw new Error('The retry interceptor must be the last interceptor defined.'); | ||
throw createMappedError(ErrorNames.http_client_retry_interceptor_not_last); | ||
} | ||
@@ -185,3 +186,3 @@ | ||
} else { | ||
throw new Error(`An invalid result was returned by the interceptor chain. Expected a Request or Response instance, but got [${result}]`); | ||
throw createMappedError(ErrorNames.http_client_invalid_request_from_interceptor, result); | ||
} | ||
@@ -188,0 +189,0 @@ |
import { IPlatform, resolve } from '@aurelia/kernel'; | ||
import { HttpClient } from '../http-client'; | ||
import { IFetchInterceptor } from '../interfaces'; | ||
import { ErrorNames, createMappedError } from '../errors'; | ||
@@ -37,3 +38,3 @@ /** | ||
&& (this.retryConfig.interval as number) <= 1000) { | ||
throw new Error('An interval less than or equal to 1 second is not allowed when using the exponential retry strategy'); | ||
throw createMappedError(ErrorNames.retry_interceptor_invalid_exponential_interval, this.retryConfig.interval); | ||
} | ||
@@ -135,3 +136,3 @@ } | ||
default: | ||
throw new Error('Unrecognized retry strategy'); | ||
throw createMappedError(ErrorNames.retry_interceptor_invalid_strategy, strategy); | ||
} | ||
@@ -138,0 +139,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
352470
65
6436
+ Added@aurelia/kernel@2.0.1-dev.202405230048(transitive)
+ Added@aurelia/metadata@2.0.1-dev.202405230048(transitive)
+ Added@aurelia/platform@2.0.1-dev.202405230048(transitive)
- Removed@aurelia/kernel@2.0.1-dev.202405110109(transitive)
- Removed@aurelia/metadata@2.0.1-dev.202405110109(transitive)
- Removed@aurelia/platform@2.0.1-dev.202405110109(transitive)