retry icon indicating copy to clipboard operation
retry copied to clipboard

Provide usage examples

Open Matzz opened this issue 10 years ago • 5 comments

This library looks great. Unfortunately lack of full examples is makes working with it quite difficult. Uncomplete code faragments are not helpfull. For example:

import scala.concurrent.ExecutionContext.Implicits.global
import scala.concurrent.Future

retry.Backoff()(Future {
  // something that can "fail"
})

produce

Multiple markers at this line
    - type mismatch; found : scala.concurrent.Future[Int] required: 
     odelay.Timer
    - type mismatch; found : scala.concurrent.Future[Unit] required: 
     odelay.Timer

or

val future = retry.Directly(4) {
  attempt
}

Leads to type mismatch; found : X required: () => scala.concurrent.Future[?]

Could you provide some simple but full examples of usage? With:

  • definition (or import) of Success,
  • some dummy operation in retry
  • performing some operation when result is complete (or failed) ?

Matzz avatar Nov 06 '14 22:11 Matzz

thanks for the feedback @Matzz I'll try and clean up the readme. In the meantime you can checkout the test dir for some examples https://github.com/softprops/retry/tree/master/src/test/scala

softprops avatar Nov 06 '14 22:11 softprops

Tests are very helpful. Thank you.

Matzz avatar Nov 06 '14 22:11 Matzz

Hi, @softprops link to tests return 404

a-nigredo avatar Mar 20 '18 08:03 a-nigredo

@a-nigredo the link now is: https://github.com/softwaremill/retry/tree/master/shared/src/test/scala

adamw avatar Mar 20 '18 17:03 adamw

Seems to have changed again to https://github.com/softwaremill/retry/tree/master/retry/src/test/scala

zbigniev avatar Sep 17 '20 10:09 zbigniev