saurabhnanda / odd-jobs

Haskell job queue with admin UI and loads of other features.
https://www.haskelltutorials.com/odd-jobs/
BSD 3-Clause "New" or "Revised" License
75 stars 29 forks source link

Need help in using JobErrHandler #61

Closed kanagarajkm closed 3 years ago

kanagarajkm commented 3 years ago

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.

saurabhnanda commented 3 years ago

@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 bee1259c2657dc5cb4265bcb651d8701b5289f94 on the fix/tests branch. Please see if that works for you.

kanagarajkm commented 3 years ago

@saurabhnanda it works, thank you

kanagarajkm commented 3 years ago

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