function checkErrors(subdomain, domain, options) {
  const codes = new Set();

  for (const [name, error] of Object.entries(subdomain.errors)) {
    assert(
      has(error, "code"),
      `Error configuration file : Missing required 'code' field (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );
    assert(
      Number.isInteger(error.code),
      `Error configuration file : Field 'code' must be an integer (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );
    assert(
      error.code > 0x0000 && error.code <= 0xffff,
      `Error configuration file : Field 'code' must be between 1 and 65535 (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );
    assert(
      !codes.has(error.code),
      `Error configuration file : code ${error.code} for error '${name}' is not unique (domain: ${domain.code}, subdomain: ${subdomain.code}).`,
    );

    codes.add(error.code);

    assert(
      has(error, "message"),
      `Error configuration file : Missing required 'message' field (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );
    assert(
      typeof error.message === "string" && error.message.length > 0,
      `Error configuration file : Field 'message' must be a non-empty string (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );

    assert(
      has(error, "class"),
      `Error configuration file : Missing required 'class' field (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );
    assert(
      typeof error.class === "string",
      `Error configuration file : Field 'class' must be a string (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
    );
    assert(
      has(errors, error.class),
      `Error configuration file : Field 'class' must target a known KuzzleError object (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}), '${name.class}' does not exist.`,
    );

    // plugin errors aren't required to have descriptions
    if (!options.plugin) {
      assert(
        typeof error.description === "string" && error.description.length > 0,
        `Error configuration file : Field 'description' must be a non-empty string (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
      );
    }

    if (error.deprecated !== undefined && error.deprecated !== null) {
      assert(
        typeof error.deprecated === "string" && error.deprecated.length > 0,
        `Error configuration file : Field 'deprecated' must be a non-empty string (domain: ${domain.code}, subdomain: ${subdomain.code}, error: ${name}).`,
      );
    }
  }
}
Check the format of the error codes files
 @param {object} - error config file domain