Properly catch errors from Javascript-Voronoi
This commit is contained in:
parent
8edfae92cb
commit
f60d68f022
20
mibpov.js
20
mibpov.js
@ -693,10 +693,16 @@ function getVoronoiDiagram(points, recalculate) {
|
||||
diagram = voronoi.compute(sites, vbbox);
|
||||
} catch(err) {
|
||||
diagram = null;
|
||||
console.error("Error when calling voronoi.compute from Javascript-Voronoi library!\n"+
|
||||
"* exception name: "+err.name+"\n"+
|
||||
"* exception message: "+err.message+"\n"+
|
||||
"* stack: "+err.stack);
|
||||
if (err instanceof Error) {
|
||||
console.error("Error when calling voronoi.compute from Javascript-Voronoi library!\n"+
|
||||
"* exception name: "+err.name+"\n"+
|
||||
"* exception message: "+err.message+"\n"+
|
||||
"* stack:\n"+err.stack);
|
||||
} else {
|
||||
console.error("Error when calling voronoi.compute from Javascript-Voronoi library!");
|
||||
console.error(err);
|
||||
throw err;
|
||||
}
|
||||
} finally {
|
||||
cachedVoronoiDiagram = diagram;
|
||||
return diagram;
|
||||
@ -1780,9 +1786,9 @@ inputImportSubmit.onclick = function() {
|
||||
} else {
|
||||
importMessage("Import failed due to internal error of type '"+err.name+"': "+err.message);
|
||||
console.error("Internal error while calling JSON.parse during import!\n"+
|
||||
"* name: "+err.name+"\n"+
|
||||
"* message: "+err.message+"\n"+
|
||||
"* stack: "+err.stack);
|
||||
"* exception name: "+err.name+"\n"+
|
||||
"* exception message: "+err.message+"\n"+
|
||||
"* stack:\n"+err.stack);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user