Refactor DeliverTx hook so that panics can be handled
Refactor DeliverTx hook so that panics can be handled (#543)
## Describe your changes and provide context
Panics in tx handler is usually handled by a defer statement containing
a `recover()` clause. Previously the call stack looks like:
```
func DeliverTx:
func runTx:
deferred recover
(actual processing)
DeliverTx hook
```
In the above structure, DeliverTx hooks are run on `DeliverTx` level, so
they are outside the deferred recover clause which is within `runTx`
level.
This PR changes it to be:
```
func DeliverTx:
func runTx:
deferred recover
(actual processing)
DeliverTx hook
```
so that the hook can be recovered as well
## Testing performed to validate your change
unit test