Open lauraluiz opened 7 years ago
Currently they are being handled all in the handleClientErrorFailedAction, but it would be better to be extracted and handled in the app.
handleClientErrorFailedAction
Current:
// SunriseLogInController.java @Override public CompletionStage<Result> handleClientErrorFailedAction(final Void input, final Form<? extends LogInFormData> form, final ClientErrorException clientErrorException) { if (isCustomerInvalidCredentialsError(clientErrorException)) { saveFormError(form, "Invalid credentials"); // TODO i18n return showFormPageWithErrors(input, form); } else { return WithContentFormFlow.super.handleClientErrorFailedAction(input, form, clientErrorException); } }
To be:
// SunriseLogInController.java @Override public CompletionStage<Result> handleClientErrorFailedAction(final Void input, final Form<? extends LogInFormData> form, final ClientErrorException clientErrorException) { if (throwable instanceof ErrorResponseException && isCustomerInvalidCredentialsError(clientErrorException)) { return handleCustomerInvalidCredentialsException(form, (ErrorResponseException) throwable); } else { return WithContentFormFlow.super.handleClientErrorFailedAction(input, form, clientErrorException); } } protected abstract CompletionStage<Result> handleCustomerInvalidCredentialsException(final Form<? extends LogInFormData> form, final ErrorResponseException errorResponseException);
Currently they are being handled all in the
handleClientErrorFailedAction
, but it would be better to be extracted and handled in the app.Current:
To be: