Skip to content

Commit 063ed06

Browse files
committed
fixing fallback issue
1 parent b3f940c commit 063ed06

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/http-client.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export default class HttpClient {
2222
#abortController;
2323
#agent;
2424
#breaker;
25+
#hasFallback = false;
2526
#logger;
2627
#throwOn400;
2728
#throwOn500;
@@ -69,6 +70,7 @@ export default class HttpClient {
6970
});
7071

7172
if (fallback) {
73+
this.#hasFallback = true;
7274
this.#fallback(fallback);
7375
}
7476
}
@@ -120,7 +122,7 @@ export default class HttpClient {
120122
try {
121123
return await this.#breaker.fire(options);
122124
} catch (error) {
123-
if (!this.fallback) {
125+
if (!this.#hasFallback) {
124126
throw new HttpClientError(
125127
`Error on ${options.method} ${options.origin}${options.path}`,
126128
{

0 commit comments

Comments
 (0)