simpleHTTP raises exception on connection refused
- Dominant language
- Haskell
- Stars
- 186
- Forks
- 59
- PR merge metrics
- No merged PRs in 30d
Description
When nothing listening on `localhost:81`, with following code:
```
(simpleHTTP (getRequest "http://localhost:81/")) >>= (\r -> case r of Left _ -> putStrLn "Error"; Right _ -> putStrLn "Alright!")
```
instead of printing `Error`, I get:
```
*** Exception: connect: does not exist (Connection refused)
```
To me, and as suggested by someone in `#haskell`, this seems like an unexpected behaviour. I'm expecting error condition to be passed in return value.
Thanks!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reading the `simpleHTTP` and `getRequest` API paths shown in the issue, then inspect how connection-refused errors are handled and how `Either` results are returned. Reproduce the example with no service listening on localhost:81; done means the failure is returned as `Left` and the example prints `Error` rather than raising an exception. The issue names no files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 38/100