Add 'error' handler to res object.