File tree 2 files changed +6
-2
lines changed
2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -91,6 +91,7 @@ data Error
91
91
| ResponseBodyError ForeignError (Response Foreign )
92
92
| TimeoutError
93
93
| RequestFailedError
94
+ | BadUrlError String
94
95
| XHROtherError Exn.Error
95
96
96
97
printError :: Error -> String
@@ -103,6 +104,8 @@ printError = case _ of
103
104
" There was a problem making the request: timeout"
104
105
RequestFailedError ->
105
106
" There was a problem making the request: request failed"
107
+ BadUrlError url ->
108
+ " There was a problem with the url: " <> url
106
109
XHROtherError err ->
107
110
" There was a problem making the request: " <> Exn .message err
108
111
@@ -198,6 +201,7 @@ request req =
198
201
in Left $
199
202
if message == timeoutErrorMessageIdent then TimeoutError
200
203
else if message == requestFailedMessageIdent then RequestFailedError
204
+ else if message == " Request path contains unescaped characters" then BadUrlError req.url
201
205
else XHROtherError err
202
206
203
207
ajaxRequest :: Nullable Foreign -> AjaxRequest a
Original file line number Diff line number Diff line change @@ -110,5 +110,5 @@ main = void $ runAff (either (\e -> logShow e *> Exn.throwException e) (const $
110
110
111
111
A .log " Testing invalid url"
112
112
AX .get ResponseFormat .string " /фыва" >>= assertLeft >>= case _ of
113
- AX.XHROtherError error → assertEq " Request path contains unescaped characters " ( Exn .message error)
114
- other → logAny' other *> assertFail " Expected a XHROtherError "
113
+ AX.BadUrlError url → assertEq " /фыва " url
114
+ other → logAny' other *> assertFail " Expected a BadUrlError "
You can’t perform that action at this time.
0 commit comments