Skip to content

Commit

Permalink
optimize "Failed to fetch" retry case
Browse files Browse the repository at this point in the history
  • Loading branch information
adrai committed Aug 19, 2024
1 parent cada195 commit 67e2a78
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 20 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
### 6.5.0

- optimize "Failed to fetch" retry case

### 6.4.3

- dereference timers in node.js so that the process may exit when finished
Expand Down
16 changes: 7 additions & 9 deletions i18nextLocizeBackend.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,11 @@ Object.defineProperty(exports, "__esModule", {
exports.default = void 0;
var _utils = require("./utils.js");
var _request = _interopRequireDefault(require("./request.js"));
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _interopRequireDefault(e) { return e && e.__esModule ? e : { default: e }; }
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
function _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError("Cannot call a class as a function"); }
function _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, "value" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }
function _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, "prototype", { writable: !1 }), e; }
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
var getDefaults = function getDefaults() {
Expand Down Expand Up @@ -450,11 +450,9 @@ var I18NextLocizeBackend = function () {
resourceNotExisting: resourceNotExisting
});
}
if (!res && err && err.message && err.message.indexOf('Failed to fetch') > -1) {
return callback('failed loading ' + url, true, {
resourceNotExisting: resourceNotExisting
});
}
if (!res && err && err.message && (err.message.indexOf('Failed to fetch') > -1 || err.message.indexOf('failed') > -1 && err.message.indexOf('fetch') > -1)) return callback('failed loading ' + url + ': ' + err.message, true, {
resourceNotExisting: resourceNotExisting
});
if (err) return callback(err, false);
var ret, parseErr;
try {
Expand Down
Loading

0 comments on commit 67e2a78

Please sign in to comment.