Skip to content

Commit

Permalink
Handle PDF fetch failures
Browse files Browse the repository at this point in the history
  • Loading branch information
desplesda committed Mar 25, 2024
1 parent 04fbc98 commit 1d253d8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/playground.ts
Original file line number Diff line number Diff line change
Expand Up @@ -383,10 +383,13 @@ export async function load (initialContentName : string = "default") {
}
var blob = await response.blob();
downloadFile(blob, "YarnSpinner-Book.pdf");
}).catch((err) => {
console.error("Error fetching PDF: ", err);
alert("Sorry, there was a problem downloading your PDF.");
}).finally(() => {
icon.classList.remove("d-none");
spinner.classList.add("d-none");

pdfDownloadInProgress = false
});
});
Expand Down

0 comments on commit 1d253d8

Please sign in to comment.