Skip to content

Commit 49fbecc

Browse files
committed
clear declarations
1 parent 9b03ee7 commit 49fbecc

File tree

2 files changed

+0
-31
lines changed

2 files changed

+0
-31
lines changed

1-js/11-async/03-promise-chaining/head.html

-19
Original file line numberDiff line numberDiff line change
@@ -10,25 +10,6 @@
1010
document.head.append(script);
1111
});
1212
}
13-
14-
class HttpError extends Error {
15-
constructor(response) {
16-
super(`${response.status} for ${response.url}`);
17-
this.name = 'HttpError';
18-
this.response = response;
19-
}
20-
}
21-
22-
function loadJson(url) {
23-
return fetch(url)
24-
.then(response => {
25-
if (response.status == 200) {
26-
return response.json();
27-
} else {
28-
throw new HttpError(response);
29-
}
30-
})
31-
}
3213
</script>
3314

3415
<style>

1-js/11-async/04-promise-error-handling/head.html

-12
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,4 @@
11
<script>
2-
function loadScript(src) {
3-
return new Promise(function(resolve, reject) {
4-
let script = document.createElement('script');
5-
script.src = src;
6-
7-
script.onload = () => resolve(script);
8-
script.onerror = () => reject(new Error("Script load error: " + src));
9-
10-
document.head.append(script);
11-
});
12-
}
13-
142
class HttpError extends Error {
153
constructor(response) {
164
super(`${response.status} for ${response.url}`);

0 commit comments

Comments
 (0)