Skip to content
This repository was archived by the owner on Jul 13, 2020. It is now read-only.

Fix confusing error when XHR statusText is blank #421

Merged
merged 1 commit into from
Aug 2, 2015

Conversation

msegado
Copy link
Contributor

@msegado msegado commented Aug 1, 2015

In the existing Error(xhr.statusText + ': ' + url || 'XHR error') implementation, XHR failures with no statusText yield error messages like : google.com since the LHS of the || is always truthy. This edit changes that to a slightly-less-cryptic XHR error: status 0 "": http://google.com (which yields useful results in a web search), or if there is a statusText, XHR error: status 403 "Forbidden": http://mydomain.com/page.

(Feel free to just change it directly in the codebase instead of merging if you prefer different formatting, etc.)

In the existing `Error(xhr.statusText + ': ' + url || 'XHR error')` implementation, the LHS of the OR is always truthy, so XHR failures with no statusText yield error messages like `: google.com`. This edit changes that to a slightly-less-cryptic `XHR error: status 0 "": http://google.com` (which yields useful results in a web search), or if there is a statusText, `XHR error: status 403 "Forbidden": http://mydomain.com/page`.

(Feel free to just change it directly in the codebase instead of merging if you prefer different formatting, etc.)
@guybedford
Copy link
Member

Sure, thanks.

guybedford added a commit that referenced this pull request Aug 2, 2015
Fix confusing error when XHR statusText is blank
@guybedford guybedford merged commit fdb52e8 into ModuleLoader:master Aug 2, 2015
@msegado msegado deleted the patch-1 branch August 2, 2015 18:20
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants