Skip to content

feat: BadUrlError #166

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/Affjax.purs
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ data Error
| ResponseBodyError ForeignError (Response Foreign)
| TimeoutError
| RequestFailedError
| BadUrlError String
| XHROtherError Exn.Error

printError :: Error -> String
Expand All @@ -119,6 +120,8 @@ printError = case _ of
"There was a problem making the request: timeout"
RequestFailedError ->
"There was a problem making the request: request failed"
BadUrlError url ->
"There was a problem with the url: " <> url
XHROtherError err ->
"There was a problem making the request: " <> Exn.message err

Expand Down Expand Up @@ -215,6 +218,8 @@ request driver req =
TimeoutError
else if message == requestFailedMessageIdent then
RequestFailedError
else if message == "Request path contains unescaped characters" then
BadUrlError req.url
Copy link
Member

Choose a reason for hiding this comment

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

It seems to me like RequestContentError would work for this case?

Then we would not have to add BadUrlError and then we would not have to bump the major version.

else
XHROtherError err

Expand Down
Loading