Resolve deprectated response in errors middleware