From c7a0c6a46349edd9c86d2b6a8d271a045980ecef Mon Sep 17 00:00:00 2001 From: farhatahmad <35435341+farhatahmad@users.noreply.github.com> Date: Wed, 10 Jul 2019 11:51:19 -0400 Subject: [PATCH] GRN2-192: Made error pages more descriptive (#620) * GRN2-192 * Brought back error codes --- app/controllers/application_controller.rb | 6 ++++- app/controllers/errors_controller.rb | 4 ---- app/views/errors/bigbluebutton_error.html.erb | 6 ++--- app/views/errors/internal_error.html.erb | 2 +- app/views/errors/not_found.html.erb | 8 +++---- app/views/errors/unauthorized.html.erb | 6 ++--- app/views/errors/unprocessable.html.erb | 23 ------------------- config/locales/en.yml | 15 ++++++------ config/routes.rb | 1 - .../application_controller_spec.rb | 16 +++++++++++-- spec/controllers/errors_controller_spec.rb | 7 ------ 11 files changed, 38 insertions(+), 56 deletions(-) delete mode 100644 app/views/errors/unprocessable.html.erb diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index c8943667..70df16a3 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -141,7 +141,11 @@ class ApplicationController < ActionController::Base retrieve_provider_info(@user_domain, 'api2', 'getUserGreenlightCredentials') rescue => e if e.message.eql? "No user with that id exists" - render "errors/not_found", locals: { user_not_found: true } + render "errors/not_found", locals: { message: I18n.t("errors.not_found.user_not_found.message"), + help: I18n.t("errors.not_found.user_not_found.help") } + elsif e.message.eql? "Provider not included." + render "errors/not_found", locals: { message: I18n.t("errors.not_found.user_missing.message"), + help: I18n.t("errors.not_found.user_missing.help") } else render "errors/internal_error" end diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 5c388a4e..e9131af4 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -21,10 +21,6 @@ class ErrorsController < ApplicationController render status: 404, formats: :html end - def unprocessable - render status: 422, formats: :html - end - def internal_error render status: 500, formats: :html end diff --git a/app/views/errors/bigbluebutton_error.html.erb b/app/views/errors/bigbluebutton_error.html.erb index b1e41b6b..f30cdd8e 100644 --- a/app/views/errors/bigbluebutton_error.html.erb +++ b/app/views/errors/bigbluebutton_error.html.erb @@ -14,7 +14,7 @@ %>
<%= I18n.t("errors.bigbluebutton.help", doc_link: "http://docs.bigbluebutton.org/greenlight/gl-install.html#setting-bigbluebutton-credentials").html_safe %>
+<%= t("errors.bigbluebutton.help", doc_link: "http://docs.bigbluebutton.org/greenlight/gl-install.html#setting-bigbluebutton-credentials").html_safe %>
<%= t("errors.internal.help") %>
diff --git a/app/views/errors/not_found.html.erb b/app/views/errors/not_found.html.erb index 95bdcbbb..d259ceac 100644 --- a/app/views/errors/not_found.html.erb +++ b/app/views/errors/not_found.html.erb @@ -14,10 +14,10 @@ %><%= t("errors.not_found.user_help") %>
+<%= help %>
<% else %><%= t("errors.not_found.help") %>
diff --git a/app/views/errors/unauthorized.html.erb b/app/views/errors/unauthorized.html.erb index 1e6682a8..23dcdd7d 100644 --- a/app/views/errors/unauthorized.html.erb +++ b/app/views/errors/unauthorized.html.erb @@ -14,7 +14,7 @@ %><%= I18n.t("errors.unauthorized.help") %>
+<%= t("errors.unauthorized.help") %>
<%= t("errors.unprocessable.help") %>
- - <%= t("go_back") %> - -