Skip to content

Commit 68dcad4

Browse files
committed
Catch XHR errors
1 parent 6e8659d commit 68dcad4

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

source-map-support.js

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,17 @@ retrieveFileHandlers.push(function(path) {
8080

8181
var contents = null;
8282
if (!fs) {
83-
// Use SJAX if we are in the browser
84-
var xhr = new XMLHttpRequest();
85-
xhr.open('GET', path, false);
86-
xhr.send(null);
87-
var contents = null
88-
if (xhr.readyState === 4 && xhr.status === 200) {
89-
contents = xhr.responseText
83+
try {
84+
// Use SJAX if we are in the browser
85+
var xhr = new XMLHttpRequest();
86+
xhr.open('GET', path, false);
87+
xhr.send(null);
88+
var contents = null
89+
if (xhr.readyState === 4 && xhr.status === 200) {
90+
contents = xhr.responseText
91+
}
92+
} catch (er) {
93+
contents = '';
9094
}
9195
} else if (fs.existsSync(path)) {
9296
// Otherwise, use the filesystem

0 commit comments

Comments
 (0)