import { error } from './response'
export default (fn, redir) => (req, res, next) =>
fn(req, res, next).catch(e =>
error(req, res, e, redir ? req.query.redirect_uri : null))