Commit a959db90 authored by Lukas Pravda's avatar Lukas Pravda
Browse files

improve error handling

parent 7354b08e
Pipeline #88032 passed with stages
in 46 seconds
......@@ -159,7 +159,7 @@ class Visualization {
let url = Resources.boundMoleculeAPI(pdbid, bmId);
d3.json(url)
.catch(e => this.processError(e, 'No interactions data are available'))
.catch(e => this.processError(e, 'No interactions data are available.'))
.then((data: any) => this.addBoundMoleculeInteractions(data, bmId))
.then(() => new Promise(resolve => setTimeout(resolve, 1500)))
.then(() => this.centerScene());
......@@ -206,7 +206,7 @@ class Visualization {
let url = Resources.ligandInteractionsAPI(pdbId, chainId, resId);
d3.json(url)
.catch(e => this.processError(e, 'No interactions data are available'))
.catch(e => this.processError(e, 'No interactions data are available.'))
.then((data: any) => this.addLigandInteractions(data))
.then(() => new Promise(resolve => setTimeout(resolve, 1500)))
.then(() => this.centerScene());
......@@ -224,7 +224,7 @@ class Visualization {
const ligandUrl = Resources.ligandAnnotationAPI(ligandId);
return d3.json(ligandUrl)
.catch(e => this.processError(e, `Depiction ${ligandId} not found`))
.catch(e => this.processError(e, `Component ${ligandId} was not found.`))
.then((d: any) => this.addDepiction(d, true))
.then(() => this.centerScene());
}
......@@ -629,7 +629,9 @@ class Visualization {
private processError(e: any, msg: string) {
this.canvas.append('text')
.classed('pdb-lig-env-svg-node', true)
.attr('x', this.parent.clientWidth / 3)
.attr('dominant-baseline', 'center')
.attr('text-anchor', 'middle')
.attr('x', this.parent.clientWidth / 2)
.attr('y', this.parent.clientHeight / 2)
.text(msg)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment