-
-
Notifications
You must be signed in to change notification settings - Fork 193
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
The "responseError" variable in Snowboard is null when a ValidationException is thrown #1211
Comments
@bennothommo any thoughts? |
@diegoflorez this is partially intended, based on the behavior of the previous AJAX framework. Validation errors in the PHP side are returned with a response code of HTTP 406 Not Acceptable, which in the old framework was interpreted as a "successful" response, because it may include partial updates (such as displaying said validation errors in a specific way in a component, for example). Thus, the validation errors are simply returned as response data, and we have kept that behavior intact with Snowboard. However, the |
responseData
instead of responseError
Winter CMS Build
1.2
PHP Version
8.1
Database engine
MySQL/MariaDB
Plugins installed
No response
Issue description
When submitting a form using
Snowboard.request
in WinterCMS, validation errors that should be caught in theresponseError
of theerror
handler are instead returned in theresponseData
of theerror
handler.The expected behavior is that validation errors, when thrown as a
ValidationException
, should be returned inresponseError
. However, they are currently being returned inresponseData
, which is inconsistent with the expected Snowboard behavior for error handling.Steps to replicate
ValidationException
class.Form Partial (HTML + JS)
Backend Handler (PHP)
Expected Behavior:
When a
ValidationException
is thrown, the error response should be captured inresponseError
in theerror
handler of theSnowboard.request
.Actual Behavior:
responseData
instead ofresponseError
.responseError
isnull
in theerror
function.Possible Fix:
Ensure that validation errors, when thrown as
ValidationException
, are returned in theresponseError
instead ofresponseData
.Environment:
Thank you for looking into this issue!
Workaround
No response
The text was updated successfully, but these errors were encountered: