-
Notifications
You must be signed in to change notification settings - Fork 3
[WIP] [TSD-85] Add exception handling for parsing HTTP requests #37
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
Conversation
…nto mdimjasevic/tsd-85-http-exceptions
…nto mdimjasevic/tsd-85-http-exceptions
| , bytestring | ||
| , containers | ||
| , directory | ||
| , either |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You really don't need this. Try it without.
…nto mdimjasevic/tsd-85-http-exceptions
…nto mdimjasevic/tsd-85-http-exceptions
ksaric
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try to focus the changes on the HTTPNetworkLayer first, then you can start with the next step.
src/HttpLayer.hs
Outdated
| import Universum | ||
|
|
||
| import Data.Aeson (FromJSON, ToJSON, Value, encode) | ||
| import Control.Exception.Safe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Incorrect formatting. You can use stylish-haskell to format imports, the general guide you can follow is here - https://github.com/serokell/serokell-util/blob/master/serokell-style.md
| -- | The connection pooled Zendesk layer. Used for database querying. | ||
| -- We need to sync occasionaly. | ||
| connPoolDataLayer :: forall m. (MonadBaseControl IO m, MonadIO m, MonadReader Config m) => DBConnPool -> DataLayer m | ||
| connPoolDataLayer :: forall m. (MonadBaseControl IO m, MonadIO m, MonadReader Config m, MonadCatch m) => DBConnPool -> DataLayer m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that constraint here?
| -- - list returns multiple results | ||
| -- - post submits a result (maybe PUT?!) | ||
| basicDataLayer :: (MonadIO m, MonadReader Config m) => DataLayer m | ||
| basicDataLayer :: (MonadIO m, MonadReader Config m, MonadCatch m) => DataLayer m |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is it here?
| Right req'' -> do | ||
| req''' <- apiCall req'' | ||
| case req''' of | ||
| Right (PageResultList pagen nextPagen count) -> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
http://hackage.haskell.org/package/base-4.6.0.0/docs/src/Data-Either.html#Either - Monad (Either e)
Please apply in other places where applicable.
src/HttpLayer.hs
Outdated
| ------------------------------------------------------------ | ||
| -- JSON parsing exceptions | ||
| ------------------------------------------------------------ | ||
| -- | Exceptions that occur during JSON parsing |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't want comments in the codebase, people forget about this.
|
Guys, focus on Look for accuracy, speed will come in time. |
|
@ksaric , there might be changes in e.g. |
|
@mdimjasevic Start with |
|
Closing in favor of #57 |
This is work in progress and is not supposed to be merged yet.
Issue: https://iohk.myjetbrains.com/youtrack/issue/TSD-85