"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RepositoryNotTreeError = void 0;
const EntitySchema_1 = require("../entity-schema/EntitySchema");
const TypeORMError_1 = require("./TypeORMError");
/**
 * Thrown when repository for the given class is not found.
 */
class RepositoryNotTreeError extends TypeORMError_1.TypeORMError {
    constructor(entityClass) {
        super();
        let targetName;
        if (entityClass instanceof EntitySchema_1.EntitySchema) {
            targetName = entityClass.options.name;
        }
        else if (typeof entityClass === "function") {
            targetName = entityClass.name;
        }
        else if (typeof entityClass === "object" && "name" in entityClass) {
            targetName = entityClass.name;
        }
        else {
            targetName = entityClass;
        }
        this.message = `Repository of the "${targetName}" class is not a TreeRepository. Try to apply @Tree decorator on your entity.`;
    }
}
exports.RepositoryNotTreeError = RepositoryNotTreeError;

//# sourceMappingURL=RepositoryNotTreeError.js.map
