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

[Bug] Error Handling for patchAssetIntoDom Function in base.html #212

Open
1 task done
wendy640 opened this issue Oct 11, 2024 · 1 comment
Open
1 task done

[Bug] Error Handling for patchAssetIntoDom Function in base.html #212

wendy640 opened this issue Oct 11, 2024 · 1 comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟩 priority: low Low priority and doesn't need to be rushed 🚧 status: blocked Blocked & therefore, not ready for work

Comments

@wendy640
Copy link
Contributor

wendy640 commented Oct 11, 2024

Description

The patchAssetIntoDom function currently lacks error handling for network issues and HTTP response errors. This can lead to silent failures, negatively impacting user experience and making debugging difficult.

Reproduction

  1. Call the patchAssetIntoDom function with an invalid asset path or an unreachable URL.
  2. Observe that no error message is displayed in the console.
  3. Check if any subsequent code that relies on the loaded asset fails silently.

Note code:

const patchAssetIntoDom = (asset, version=null) => {
const ajax = new XMLHttpRequest();
ajax.open("GET", getFullyQualifiedUrl(asset, version), true);
ajax.onload = () => {
var div = document.createElement("div");
// Render SVG in the page
div.innerHTML = ajax.responseText;
div.style.display = 'none';
document.body.insertBefore(div, document.body.childNodes[0]);
}
ajax.send();
}
patchAssetIntoDom('assets/logos/cc/logomark.svg');

Expectation

I expected to see error messages in the console if the asset fails to load, either due to a network issue or an HTTP error status. This would help identify problems more quickly and improve the overall reliability of the application.

Environment

  • Device: (eg. iPhone Xs; laptop)
  • OS: (eg. iOS 13.5; Fedora 32)
  • Browser: (eg. Safari; Firefox)
  • Version: (eg. 13; 73)
  • Other info: (eg. display resolution, ease-of-access settings)

Additional context

Resolution

  • I would be interested in resolving this bug.
@wendy640 wendy640 added 💻 aspect: code Concerns the software code in the repository 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work 🛠 goal: fix Bug fix 🟧 priority: high Stalls work on the project or its dependents labels Oct 11, 2024
@cc-open-source-bot cc-open-source-bot moved this to Triage in TimidRobot Oct 11, 2024
@TimidRobot TimidRobot added 🟩 priority: low Low priority and doesn't need to be rushed 🚧 status: blocked Blocked & therefore, not ready for work and removed 🟧 priority: high Stalls work on the project or its dependents 🚦 status: awaiting triage Has not been triaged & therefore, not ready for work labels Oct 14, 2024
@TimidRobot
Copy link
Member

🚧 status: blocked Blocked & therefore, not ready for work as I expect this issue will be resolved by migrating this project to the current Vocabulary design system:

@TimidRobot TimidRobot moved this from Triage to Backlog in TimidRobot Oct 14, 2024
@TimidRobot TimidRobot moved this to Backlog in possumbilities Oct 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻 aspect: code Concerns the software code in the repository 🛠 goal: fix Bug fix 🟩 priority: low Low priority and doesn't need to be rushed 🚧 status: blocked Blocked & therefore, not ready for work
Projects
Status: Backlog
Status: Backlog
Development

No branches or pull requests

2 participants