Skip to content

Commit

Permalink
try to catch error
Browse files Browse the repository at this point in the history
  • Loading branch information
vhargrave committed Feb 29, 2024
1 parent 3f1b6c9 commit fe5d2a5
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion libs/features/georoutingv2/georoutingv2.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const geo2jsonp = (callback) => {
const callbackName = `jsonp_${Math.round(100000 * Math.random())}`;

const script = document.createElement('script');
script.src = `https://geo2.adobe.com/json/?callback=${callbackName}`;
script.src = `https://geo2.adobe.comasdf/json/?callback=${callbackName}`;

// Define the function that the script will call
window[callbackName] = (data) => {
Expand All @@ -50,6 +50,11 @@ const geo2jsonp = (callback) => {
callback(data);
};

script.onerror = () => {
delete window[callbackName];
document.body.removeChild(script);
};

document.body.appendChild(script);
};

Expand Down

0 comments on commit fe5d2a5

Please sign in to comment.