saurabhnanda/odd-jobs

Need help in using JobErrHandler

Closed this issue · 3 comments

I have tried to use the error handler like following

mkConfig
                logger
                jobTableName
                dbPool
                (MaxConcurrentJobs 50)
                jobRunner
                ( \c -> do
                    c {cfgDefaultMaxAttempts = 1,
                       cfgOnJobFailed = [JobErrHandler $ \ (e :: SomeException) job failMode -> print "Test"]
                      }
                )

It throws the following error

    _ Couldn't match type _a1_ with _()_
      _a1_ is a rigid type variable bound by
        a type expected by the context:
          forall a1. [JobErrHandler a1]
        at app/Main.hs:61:41-109
      Expected type: JobErrHandler a1
        Actual type: JobErrHandler ()
    _ In the expression:
        JobErrHandler $ \ (e :: SomeException) job failMode -> print "Test"
      In the _cfgOnJobFailed_ field of a record
      In a stmt of a 'do' block:
        c {cfgDefaultMaxAttempts = 1,
           cfgOnJobFailed = [JobErrHandler
                               $ \ (e :: SomeException) job failMode -> print "Test"]}
   |
61 |                        cfgOnJobFailed = [JobErrHandler $ \ (e :: SomeException) job failMode -> print "Test"]

Could anyone please help in resolving this. Thanks in advance.

@kanagarajkm apologies for the delayed response. I was working very sporadically due to holidays.

This is a bug. I have pushed a fix (along with tests) at bee1259 on the fix/tests branch. Please see if that works for you.

@saurabhnanda it works, thank you

@saurabhnanda is it possible to make a release with this fix? thanks