Have a look at the HTTP channel ‘error’ property. It can be used so you can handle non-200 statuses yourself.
The error property is an expression returning non-#f if the message should be treated as an error.
This property is used to specify special cases that you want to handle yourself. By default anything other than a status of 200 will be treated as an error. By setting this to something different, you can handle the exceptions yourself. If you handle the message yourself, the raw message is passed into your service as “this”.
; accept responses with status code of OK (200) or Redirection (302) – reject all others
(not (in? (this’status) ‘(200 302)))
To handle 400 or 500 errors, just add them to the list.