reduxkotlin/redux-kotlin-thunk

Thunk exceptions are being masked

jason-whitted opened this issue · 1 comments

In Thunk.kt there is this try catch:

try {
	(action as Thunk<*>)(store.dispatch, store.getState, extraArgument)
} catch (e: Exception) {
	throw IllegalArgumentException()
// Logger.d("Dispatching functions must use type Thunk: " + e.message)
}

The try..catch is masking any errors that may have occurred in the thunk.
It would be helpful if it did something like this:

val thunk = try { action as Thunk<*> } 
            catch(ex: ClassCastException) { throw IllegalArgumentException() }
return thunk(store.dispatch, store.getState, extraArgument)

Thanks for reporting @jason-whitted issue has been fixed and will be published in the next release.