Skip to content
This repository was archived by the owner on Mar 11, 2023. It is now read-only.

add custom error handler #213

Merged

Conversation

alexbalonperin
Copy link

part of #144

Copy link
Author

@alexbalonperin alexbalonperin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR also needs some tests.

response.entity.withoutSizeLimit.dataBytes
.via(Framing.delimiter(ByteString("\r\n"), Int.MaxValue).async)
.filter(_.nonEmpty)
.via(killSwitch.flow)
.map(data => unmarshalStream(data, f))
.recoverWithRetries(attempts = 3, {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally, the number of attempts should be configurable.

package com.danielasfregola.twitter4s.http.clients.streaming

object ErrorHandler {
def default: PartialFunction[Throwable, Unit] = {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, could you change it to ignore?

Copy link
Owner

@DanielaSfregola DanielaSfregola left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @zolrag13,
thanks for your contribution!

LGTM

@codecov
Copy link

codecov bot commented Mar 16, 2018

Codecov Report

Merging #213 into master will increase coverage by 0.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #213      +/-   ##
==========================================
+ Coverage   94.22%   94.23%   +0.01%     
==========================================
  Files          72       73       +1     
  Lines        1143     1145       +2     
  Branches       12       13       +1     
==========================================
+ Hits         1077     1079       +2     
  Misses         66       66
Impacted Files Coverage Δ
...ients/streaming/statuses/TwitterStatusClient.scala 92.85% <100%> (ø) ⬆️
...ter4s/http/clients/streaming/StreamingClient.scala 100% <100%> (ø) ⬆️
...tp/clients/streaming/users/TwitterUserClient.scala 100% <100%> (ø) ⬆️
...tp/clients/streaming/sites/TwitterSiteClient.scala 100% <100%> (ø) ⬆️
...witter4s/http/clients/streaming/ErrorHandler.scala 100% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 6e393db...f768891. Read the comment docs.

@DanielaSfregola DanielaSfregola merged commit 16bcf73 into DanielaSfregola:master Mar 16, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants