Jobs icon indicating copy to clipboard operation
Jobs copied to clipboard

Extra argument 'onError'

Open Ponyboy47 opened this issue 7 years ago • 2 comments

So I followed the documentation and I even looked at the source code, but I have no idea why I'm getting this error. This should be acceptable code, but the compiler is telling me it's invalid.

This may not be the best way to do what I'm intending, but I don't know how else to have a job stop itself after it's started.

Jobs.add(name: "startConversion", interval: .minutes(1), autoStart: true, action: {
      log.verbose("Checking if it is time to start converting media...")
      if isTime() {
          startConversion()
          throw ConversionError.stopJob
      }
}, onError: { error in
      return RecoverStrategy.none
})

I get an error that says: extra argument 'onError' in call.

I'm doing exactly what is documented and what is in the source code. I'm using the 1.0.0-beta.1 release, installed with SPM for my project. I'm using swift 3.1 on Ubuntu 16.04

Ponyboy47 avatar Apr 13 '17 18:04 Ponyboy47

Hmm... My guess would be something to do with the way error isn't being used. Trying changing it to _ and see if your error message improves at all.

BrettRToomey avatar Apr 27 '17 13:04 BrettRToomey

@Ponyboy47 I think this error is swift related. Swift sometimes displays extra argument in call error when you have a problem in a closure. Your action closure might contain a development error. A possible debug option is to move all the closure code outside the closure and check if it's running correctly.

MaherKSantina avatar Oct 07 '18 04:10 MaherKSantina