@inappstory/game-center-api 1.3.2 → 1.3.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/lib/ResourceManager.js +6 -3
- package/package.json +1 -1
package/lib/ResourceManager.js
CHANGED
|
@@ -83,14 +83,17 @@ class ResourceManager {
|
|
|
83
83
|
});
|
|
84
84
|
}
|
|
85
85
|
async createObjectUrlByUri(uri, resouceKeys) {
|
|
86
|
-
if (!uri)
|
|
86
|
+
if (!uri) {
|
|
87
87
|
throw `Resource uri for [${resouceKeys.join(", ")}] can't be empty string`;
|
|
88
|
+
}
|
|
88
89
|
try {
|
|
89
90
|
const response = await (0, fetchLocalFile_1.fetchLocalFile)(uri);
|
|
90
|
-
if (response != null)
|
|
91
|
+
if (response != null && response.ok) {
|
|
91
92
|
return URL.createObjectURL(await response.blob());
|
|
92
|
-
|
|
93
|
+
}
|
|
94
|
+
else {
|
|
93
95
|
throw "";
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
98
|
catch (err) {
|
|
96
99
|
console.warn(`Error to fetch ${uri} for related images [${resouceKeys.join(", ")}]`, err);
|