Add pause-on-error middleware.
Improve pause-on-error middleware.