import log from "@shared/utils/logger.ts";

export class ErrorBase extends Error {
    constructor(message: string = "An unknown error has occurred") {
        super(message);
        this.name = this.constructor.name;
    }
}

export class QueryExecutionError extends ErrorBase {
    public readonly code = "QueryExecutionError";
    constructor(message: string) {
        super(message);
    }
}

export class NoAdminEntryError extends ErrorBase {
    public readonly code = "NoAdminEntry";
    constructor(message: string) {
        super(message);
    }
}

export class FailedToReadFileError extends ErrorBase {
    public readonly code = "FailedToReadFileError";
    constructor(message: string) {
        super(message);
    }
}

export class InvalidSyntaxError extends ErrorBase {
    public readonly code = "InvalidSyntax";
    constructor(message: string) {
        super(message);
    }
}

export class InvalidPathError extends ErrorBase {
    public readonly code = "InvalidPath";
    constructor(message: string) {
        super(message);
    }
}

export class AdminPasswordNotSetError extends ErrorBase {
    public readonly code = "AdminPasswordNotSetError";
    constructor(message: string) {
        super(message);
    }
}
