diff --git a/src/utils/media-utils.js b/src/utils/media-utils.js index 7328fe72ac579f214565611a6eb038f58af68a6e..697612d530e848a3307a142f792ccd142cade41d 100644 --- a/src/utils/media-utils.js +++ b/src/utils/media-utils.js @@ -42,12 +42,16 @@ export const addMedia = (src, resize = false) => { scene.appendChild(entity); if (typeof src === "object") { - upload(src).then(response => { - const src = response.raw; - const contentType = response.meta.expected_content_type; - const token = response.meta.access_token; - entity.setAttribute("media-loader", { src, contentType, token }); - }); + upload(src) + .then(response => { + const src = response.raw; + const contentType = response.meta.expected_content_type; + const token = response.meta.access_token; + entity.setAttribute("media-loader", { src, contentType, token }); + }) + .catch(() => { + entity.setAttribute("media-loader", { src: "error" }); + }); } return entity; };