diff --git a/src/extensions/cellpack/model.ts b/src/extensions/cellpack/model.ts index 3378fa77a34c69d82ccb16617b8be280b2e98c91..9344fed2a3e3a3a24ae81a508d0627ada27f1e0b 100644 --- a/src/extensions/cellpack/model.ts +++ b/src/extensions/cellpack/model.ts @@ -68,11 +68,13 @@ async function getModel(plugin: PluginContext, id: string, ingredient: Ingredien } } else if (id.match(/^[1-9][a-zA-Z0-9]{3,3}$/i)) { if (surface){ - const data = await getFromOPM(plugin, id, assetManager); - if (data.asset){ + try { + const data = await getFromOPM(plugin, id, assetManager); assets.push(data.asset); trajectory = await plugin.runTask(trajectoryFromPDB(data.pdb)); - } else { + } catch (e) { + // fallback to getFromPdb + // console.error(e); const { mmcif, asset } = await getFromPdb(plugin, id, assetManager); assets.push(asset); trajectory = await plugin.runTask(trajectoryFromMmCIF(mmcif)); diff --git a/src/mol-util/data-source.ts b/src/mol-util/data-source.ts index 1ff444020ddfb54c500f4b8896e823adeb7bc8ba..609d1a9d5f217fdc283b666c75e6ed0b91b9dd98 100644 --- a/src/mol-util/data-source.ts +++ b/src/mol-util/data-source.ts @@ -241,9 +241,8 @@ function processAjax<T extends DataType>(req: XMLHttpRequest, type: T): DataResp } throw new Error(`could not get requested response data '${type}'`); } else { - const status = req.statusText; RequestPool.deposit(req); - throw new Error(status); + throw new Error(`Download failed with status code ${req.status}`); } }