File size: 457 Bytes
c01955c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class ApiError extends Error {
    public statusCode: number;
    public success: boolean;

    constructor(status: number, message = "something went wrong") {
        super(message);
        this.statusCode = status;
        this.message = message;
        this.success = false;
        
        // Ensure the prototype is correctly set for built-in Error extension
        Object.setPrototypeOf(this, ApiError.prototype);
    }
}

export default ApiError;