Properly catch errors from Javascript-Voronoi

This commit is contained in:
Wuzzy 2023-10-26 12:53:43 +02:00
parent 8edfae92cb
commit f60d68f022

View File

@ -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;
}