Skip to content
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

Throw startServer exceptions synchronously #86

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

pepeiborra
Copy link

Error handling doesn't currently work with forkServer:

do
  s <- Just <$> forkServer "localhost" 8000 `catchAny` \e -> pure Nothing

The above code will not manage to deal with "port already in use" or similar, since the exceptions are being thrown asynchronously to the main thread.

To address that we use an Async to hold the server, so there's no longer a need to throw the exception back to the main thread.

Error handling doesn't currently work with `forkServer`:
```
do
  s <- Just <$> forkServer "localhost" 8000 `catchAny` \e -> pure Nothing
```

The above code will not manage to deal with "port already in use" or similar, since the exceptions are being thrown asynchronously to the main thread.

To address that we use an Async to hold the server, so there's no longer a need to throw the exception back to the main thread.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant