Added res.err and rpc middleware support.