Skip to content

Commit

Permalink
throw error on error
Browse files Browse the repository at this point in the history
  • Loading branch information
UziTech committed Mar 27, 2018
1 parent 5340381 commit 3d357e9
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,12 @@ <h1>Marked.js Documentation</h1>
return Promise.resolve();
}
return fetch(page)
.then(function (res) { return res.text(); })
.then(function (res) {
if (!res.ok) {
throw new Error('Error ' + res.status + ': ' + res.statusText);
}
return res.text();
})
.then(function (text) {
renderedPage = page;
content.innerHTML = marked(text);
Expand Down

0 comments on commit 3d357e9

Please sign in to comment.