File size: 461 Bytes
ece5841
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
class NotFoundError {
    constructor(message) {
        this.message = message;
        this.status = 404;
    }
}

class NotAuthError {
    constructor(message) {
        this.message = message;
        this.status = 401;
    }
}

function catchAsync(callback) {
    return (req, res, next) => {
        callback(req, res, next).catch(next);
    };
}

exports.NotFoundError = NotFoundError;
exports.NotAuthError = NotAuthError;
exports.catchAsync = catchAsync