Commit d7750027 authored by Sean Hammond's avatar Sean Hammond

Handle internal server errors in the registration form

This fixes #1755: no error is shown on the client side when an attempt
to register an account receives a 500 Server Error response.

The failure() method in AuthController gets called and tries to do
{errors, reason} = response.data, but this raises a TypeError because
response.data is undefined (because the response didn't have a valid
JSON body), so the client crashes as well.

The fix is to catch this exception on the client side, and show a
generic error to the user.
parent 7d19d654
......@@ -18,7 +18,12 @@ class AuthController
$scope.form?.$setPristine()
failure = (form, response) ->
{errors, reason} = response.data
try
{errors, reason} = response.data
catch
form.responseErrorMessage = "Oops, something went wrong on the server.
Please try again later!"
return
formHelpers.applyValidationErrors(form, errors, reason)
this.submit = (form) ->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment