ibm-cloud-sdk-core 4.2.2 → 4.2.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## [4.2.3](https://github.com/IBM/node-sdk-core/compare/v4.2.2...v4.2.3) (2024-02-01)
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
### Bug Fixes
|
|
5
|
+
|
|
6
|
+
* **token-manager:** handle request errors when refreshing tokens ([#267](https://github.com/IBM/node-sdk-core/issues/267)) ([2909804](https://github.com/IBM/node-sdk-core/commit/290980474d8e567612d36d6160315ee7e433b07b))
|
|
7
|
+
|
|
1
8
|
## [4.2.2](https://github.com/IBM/node-sdk-core/compare/v4.2.1...v4.2.2) (2024-01-04)
|
|
2
9
|
|
|
3
10
|
|
|
@@ -56,6 +56,15 @@ var TokenManager = /** @class */ (function () {
|
|
|
56
56
|
if (this.tokenNeedsRefresh()) {
|
|
57
57
|
this.requestToken().then(function (tokenResponse) {
|
|
58
58
|
_this.saveTokenInfo(tokenResponse);
|
|
59
|
+
}, function (err) {
|
|
60
|
+
// If the refresh request failed: catch the error, log a message, and return the stored token.
|
|
61
|
+
// The attempt to get a new token will be retried upon the next request.
|
|
62
|
+
var message = 'Attempted token refresh failed. The refresh will be retried with the next request.';
|
|
63
|
+
if (err && err.message) {
|
|
64
|
+
message += " ".concat(err.message);
|
|
65
|
+
}
|
|
66
|
+
logger_1.default.error(message);
|
|
67
|
+
logger_1.default.debug(err);
|
|
59
68
|
});
|
|
60
69
|
}
|
|
61
70
|
// 2. use valid, managed token
|
|
@@ -49,6 +49,15 @@ export class TokenManager {
|
|
|
49
49
|
if (this.tokenNeedsRefresh()) {
|
|
50
50
|
this.requestToken().then((tokenResponse) => {
|
|
51
51
|
this.saveTokenInfo(tokenResponse);
|
|
52
|
+
}, (err) => {
|
|
53
|
+
// If the refresh request failed: catch the error, log a message, and return the stored token.
|
|
54
|
+
// The attempt to get a new token will be retried upon the next request.
|
|
55
|
+
let message = 'Attempted token refresh failed. The refresh will be retried with the next request.';
|
|
56
|
+
if (err && err.message) {
|
|
57
|
+
message += ` ${err.message}`;
|
|
58
|
+
}
|
|
59
|
+
logger.error(message);
|
|
60
|
+
logger.debug(err);
|
|
52
61
|
});
|
|
53
62
|
}
|
|
54
63
|
// 2. use valid, managed token
|