Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Polling page should watch out for errors and display them #10

Closed
simonw opened this issue Mar 6, 2024 · 3 comments
Closed

Polling page should watch out for errors and display them #10

simonw opened this issue Mar 6, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@simonw
Copy link
Collaborator

simonw commented Mar 6, 2024

If an error occurs it should display that error and stop polling.

Table is being introduced here: 050612c

@simonw simonw added the enhancement New feature or request label Mar 6, 2024
@simonw
Copy link
Collaborator Author

simonw commented Mar 6, 2024

Relevant code:

async function pollData() {
const response = await fetch(pollUrl);
const data = await response.json();
if (data && data.items && data.items.length) {
outputElement.textContent = JSON.stringify(data.items, null, 2);
}
if (data.done) {
clearInterval(pollInterval);
const loadingSpinner = document.getElementById("loadingSpinner");
loadingSpinner.parentNode.removeChild(loadingSpinner);
const doneMessage = document.createElement("p");
doneMessage.style.fontWeight = "bold";
doneMessage.textContent = "Extraction complete!";
outputElement.parentNode.appendChild(doneMessage);
}
}

@simonw
Copy link
Collaborator Author

simonw commented Mar 6, 2024

It's actually polling an in-memory structure already which should make errors available, so no need to check the table.

@simonw simonw changed the title Polling page should check _datasette_extract table for errors Polling page should watch out for errors and display them Mar 6, 2024
@simonw simonw closed this as completed in 53bfb09 Apr 9, 2024
@simonw
Copy link
Collaborator Author

simonw commented Apr 9, 2024

Errors now display like this:

CleanShot 2024-04-09 at 12 21 12@2x

simonw added a commit that referenced this issue Apr 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant