Comparing version 1.10.2 to 1.10.3
{ | ||
"author": "Jan Muehlemann" | ||
, "name": "i18next.remotesync" | ||
, "version": "1.6.3" | ||
, "contributors": [ | ||
, "version": "1.6.4" | ||
, "contributors": [ | ||
{ "name": "Jan Muehlemann", "email": "jan.muehlemann@gmail.com" } | ||
@@ -20,4 +20,4 @@ ] | ||
} | ||
, "scripts" : { | ||
"test" : "mocha" } | ||
, "scripts" : { | ||
"test" : "mocha" } | ||
} |
@@ -16,2 +16,6 @@ var request = require('request'); | ||
cb(err); | ||
} else if (res.statusCode && res.statusCode.toString().indexOf('5') === 0) { | ||
var err = new Error(res.statusMessage); | ||
err.i18nSkipOnError = true; | ||
cb(err); | ||
} else { | ||
@@ -101,3 +105,3 @@ try { | ||
if (err) console.log(err); | ||
}); | ||
}); | ||
}); | ||
@@ -113,7 +117,7 @@ } | ||
} | ||
var merged = {}; | ||
for (var attrname in defaultOptions) { merged[attrname] = defaultOptions[attrname]; } | ||
for (attrname in options) { if (options[attrname]) merged[attrname] = options[attrname]; } | ||
return merged; | ||
return merged; | ||
}; |
@@ -0,1 +1,4 @@ | ||
### v1.10.3 | ||
- allows backends to promote an error having err.i18nSkipOnError that will prevent setting an empty resource set and allows a reload on next access this way (usable in remotesync if remote in unavailable) | ||
### v1.10.2 | ||
@@ -2,0 +5,0 @@ - update client |
@@ -304,2 +304,7 @@ (function() { | ||
// skip that if we get an error having `.i18nSkipOnError` | ||
// this is used in remote sync to promote an unavaiable remote | ||
// so resources could be loaded on next request | ||
if (fetched[n][toAddNs] && fetched[n][toAddNs].i18nSkipOnError) continue; | ||
self.resStore[n] = self.resStore[n] || {}; | ||
@@ -348,8 +353,7 @@ self.resStore[n][toAddNs] = self.resStore[n][toAddNs] || {}; | ||
if(err) { | ||
store[lngValue][nsValue] = {}; | ||
if (err) { | ||
store[lngValue][nsValue] = !err.i18nSkipOnError ? {} : err; | ||
} else { | ||
store[lngValue][nsValue] = data; | ||
} | ||
else { | ||
store[lngValue][nsValue] = data; | ||
} | ||
@@ -356,0 +360,0 @@ todo--; // wait for all done befor callback |
@@ -5,3 +5,3 @@ { | ||
"description": "i18n made easy - full featured: middleware, template support plus clientside use", | ||
"version": "1.10.2", | ||
"version": "1.10.3", | ||
"repository": { | ||
@@ -8,0 +8,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
854986
4463