/**
 * Generated by veryExpress@0.6.6-alpha 
 * https://github.com/Justin26l/VeryExpress
 */

import { ResponseCode } from "./../../_utils/response.gen";
import utils from "./../../_utils/index";

export class VexResErr extends Error {
    public status: number;
    public ret_code: ResponseCode | string;
    public ret_msg: any;

    constructor(
        status: number = 200, 
        code?: ResponseCode | null,
        message?: string,
    ) {
        super(message);
        this.name = "VexResErr";
        this.status = status;
        this.ret_code = code || utils.response.statusCodeMap.get(status) || utils.response.code.SERVER_ERROR;
        this.ret_msg = message || utils.response.msg.SERVER_ERROR;
    }
}