Catch all errors thrown by a Speed Provider's getCostForStep function
This commit is contained in:
+9
-3
@@ -101,10 +101,16 @@ export function getUnreachableColorFromSpeedProvider() {
|
||||
}
|
||||
|
||||
export function getCostFromSpeedProvider(token, area) {
|
||||
if (currentSpeedProvider instanceof Function) {
|
||||
return SpeedProvider.prototype.getCostForStep.call(undefined, token, area);
|
||||
try {
|
||||
if (currentSpeedProvider instanceof Function) {
|
||||
return SpeedProvider.prototype.getCostForStep.call(undefined, token, area);
|
||||
}
|
||||
return currentSpeedProvider.getCostForStep(token, area);
|
||||
}
|
||||
catch (e) {
|
||||
console.error(e);
|
||||
return 1;
|
||||
}
|
||||
return currentSpeedProvider.getCostForStep(token, area);
|
||||
}
|
||||
|
||||
export function getMovedDistanceFromToken(token) {
|
||||
|
||||
Reference in New Issue
Block a user