export class DjangoValidationError extends Error {
  errors;

  constructor(errObject) {
    super("");
    this.name = "DjangoValidationError";

    const fieldsErrors = [];

    for (const field in errObject) {
      fieldsErrors.push({
        name: field,
        errors: errObject[field],
      });
    }

    this.errors = fieldsErrors;
  }
}
