Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proper Handling of Validation messages #82

Open
silbinarywolf opened this issue Jun 21, 2017 · 0 comments
Open

Proper Handling of Validation messages #82

silbinarywolf opened this issue Jun 21, 2017 · 0 comments

Comments

@silbinarywolf
Copy link
Contributor

FileAttachmentField.php should show the validation exception message provided with something like the following.

try {
    $this->upload->loadIntoFile($tmpFile, $fileObject, $this->getFolderName());
    $ids[] = $fileObject->ID;
} catch (ValidationException $e) {
  return $this->httpError(400, $e->getMessage());
} catch (Exception $e) {
  $error_message = _t('FileAttachmentField.GENERALUPLOADERROR', 'Sorry, the file could not be saved at the current time, please try again later.');
  return $this->httpError(400, $error_message);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant