purescript-contrib / purescript-affjax

An asynchronous AJAX library built using Aff.
Apache License 2.0
121 stars 78 forks source link

throw timeout error not as `XHRError Exn.Error`, but as separate error #156

Closed srghma closed 3 years ago

srghma commented 3 years ago

Description of the change

fixes https://github.com/purescript-contrib/purescript-affjax/issues/155


Checklist:

srghma commented 3 years ago

example of XHROtherError

Error__AffjaxError {
  value0: XHROtherError {
    value0: TypeError [ERR_UNESCAPED_CHARACTERS]: Request path contains unescaped characters
        at new ClientRequest (_http_client.js:151:13)
        at Object.request (https.js:313:10)
        at XMLHttpRequest._sendHxxpRequest (/home/srghma/projects/extract-pdf-notes/node_modules/xhr2/lib/xhr2.js:480:24)
        at XMLHttpRequest._sendHttp (/home/srghma/projects/extract-pdf-notes/node_modules/xhr2/lib/xhr2.js:460:14)
        at XMLHttpRequest.send (/home/srghma/projects/extract-pdf-notes/node_modules/xhr2/lib/xhr2.js:278:18)
        at /home/srghma/projects/extract-pdf-notes/output/Affjax/foreign.js:84:11
        at __do (/home/srghma/projects/extract-pdf-notes/output/Effect.Aff.Compat/index.js:15:22)
        at runAsync (/home/srghma/projects/extract-pdf-notes/output/Effect.Aff/foreign.js:98:20)
        at run (/home/srghma/projects/extract-pdf-notes/output/Effect.Aff/foreign.js:333:22)
        at /home/srghma/projects/extract-pdf-notes/output/Effect.Aff/foreign.js:348:19 {
      code: 'ERR_UNESCAPED_CHARACTERS'
    }
  }
}

if one forgets to use JSURI.encodeURIComponent