export class PeerTubeError extends Error {
    code;
    isPeerTubeError = true;
    constructor(message, code, cause) {
        super(message, { cause });
        this.code = code;
    }
    static fromError(error, code) {
        return new PeerTubeError(error.message, code, error);
    }
}
export function isPeerTubeError(error) {
    if (!error)
        return false;
    return error instanceof PeerTubeError || error.isPeerTubeError === true;
}
//# sourceMappingURL=peertube-error.model.js.map