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

For request failures and timeouts, include the URLs in the errors #1475

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

giles-v
Copy link

@giles-v giles-v commented Dec 18, 2024

When working with complex Jest tests which mount large component trees, it can be difficult to nail down which request is causing test failures with the current message. Echo the specific method and URL into the Error, so that debugging is easier.

@@ -558,13 +558,13 @@ export function fetch(input, init) {

xhr.onerror = function() {
setTimeout(function() {
reject(new TypeError('Network request failed'))
reject(new TypeError('Network request ('+request.method+' '+request.url+') failed'))
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These would be neater as string template literals, but since those were not currently in use in the codebase, I opted to match the existing style of plain strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant