Skip to content

Commit 5282225

Browse files
author
perliedman
committed
Fix broken error handling
1 parent dc0582c commit 5282225

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

src/L.Routing.OSRM.js

+6-7
Original file line numberDiff line numberDiff line change
@@ -65,17 +65,16 @@
6565
if (!err) {
6666
try {
6767
data = JSON.parse(resp.responseText);
68+
try {
69+
return this._routeDone(data, wps, callback, context);
70+
} catch (ex) {
71+
statusCode = -3;
72+
errorMessage = ex.toString();
73+
}
6874
} catch (ex) {
6975
statusCode = -2;
7076
errorMessage = 'Error parsing OSRM response: ' + ex.toString();
7177
}
72-
73-
try {
74-
return this._routeDone(data, wps, callback, context);
75-
} catch (ex) {
76-
statusCode = -3;
77-
errorMessage = ex.toString();
78-
}
7978
}
8079

8180
callback.call(context || callback, {

0 commit comments

Comments
 (0)