Commit f586dcd86af9a4aa9ca580f6cdcc262574b3803d
Committed by
Paulo Meireles
1 parent
820be114
Exists in
master
and in
22 other branches
[Mezuro] processing error in module_result.
Showing
5 changed files
with
17 additions
and
7 deletions
Show diff stats
plugins/mezuro/controllers/profile/mezuro_plugin_module_controller.rb
| ... | ... | @@ -55,11 +55,6 @@ class MezuroPluginModuleController < MezuroPluginProfileController |
| 55 | 55 | end |
| 56 | 56 | end |
| 57 | 57 | |
| 58 | - def redirect_to_error_page(message) | |
| 59 | - message = URI.escape(CGI.escape(message),'.') | |
| 60 | - redirect_to "/profile/#{profile.identifier}/plugins/mezuro/error_page?message=#{message}" | |
| 61 | - end | |
| 62 | - | |
| 63 | 58 | def format_date_to_simple_form date |
| 64 | 59 | date.to_s[0..9] |
| 65 | 60 | end | ... | ... |
plugins/mezuro/controllers/profile/mezuro_plugin_profile_controller.rb
| ... | ... | @@ -2,12 +2,25 @@ class MezuroPluginProfileController < ProfileController |
| 2 | 2 | |
| 3 | 3 | append_view_path File.join(File.dirname(__FILE__) + '/../../views') |
| 4 | 4 | |
| 5 | + rescue_from Exception do |exception| | |
| 6 | + @message = process_error_message exception.message | |
| 7 | + render :partial => "error_page" | |
| 8 | + end | |
| 9 | + | |
| 5 | 10 | def error_page |
| 6 | 11 | @message = params[:message] |
| 7 | 12 | end |
| 8 | 13 | |
| 9 | 14 | protected |
| 10 | 15 | |
| 16 | + def process_error_message message | |
| 17 | + if message =~ /undefined method `module' for nil:NilClass/ | |
| 18 | + "Kalibro did not return any result. Verify if the selected configuration is correct." | |
| 19 | + else | |
| 20 | + message | |
| 21 | + end | |
| 22 | + end | |
| 23 | + | |
| 11 | 24 | def project_content_has_errors? |
| 12 | 25 | not @content.errors[:base].nil? |
| 13 | 26 | end | ... | ... |
plugins/mezuro/views/mezuro_plugin_module/_error_page.html.erb
0 → 100644
plugins/mezuro/views/mezuro_plugin_profile/_error_page.html.erb
0 → 100644
plugins/mezuro/views/mezuro_plugin_profile/error_page.html.erb