docs: def from_validation_exception(cls, exception, **kwargs):
          """Create an error from validation exception."""
          errors = []
  
          def flatten(error, path=""):
              if isinstance(error, halogen.exceptions.ValidationError):
                  if not path.endswith("/"):
                      path += "/"
                  if error.attr is not None:
                      path += error.attr
                  elif error.index is not None:
                      path += six.text_type(error.index)
  
                  for e in error.errors:
                      flatten(e, path)
              else:
                  message = error
                  if isinstance(error, Exception):
                      try:
                          message = error.message
                      except AttributeError:
                          message = six.text_type(error)
                  # TODO: i18n
                  errors.append(Error(message=message, path=path))
  
          flatten(exception)
          message = kwargs.pop("message", "Validation error.")
          return cls(message=message, errors=sorted(errors, key=lambda error: error.path or ""), **kwargs)