lib/server.rb in machinery-tool-1.19.0 vs lib/server.rb in machinery-tool-1.20.0
- old
+ new
@@ -333,13 +333,14 @@
begin
@description = SystemDescription.load(params[:id], settings.system_description_store)
rescue Machinery::Errors::SystemDescriptionNotFound => e
session[:error] = e.to_s
redirect "/"
- rescue Machinery::Errors::SystemDescriptionIncompatible => e
+ rescue Machinery::Errors::SystemDescriptionIncompatible, \
+ Machinery::Errors::SystemDescriptionError => e
@error = e
- haml File.read(File.join(Machinery::ROOT, "html/upgrade.html.haml"))
+ haml File.read(File.join(Machinery::ROOT, "html/exception.html.haml"))
else
diffs_dir = @description.scope_file_store("analyze/changed_config_files_diffs").path
if @description.changed_config_files && diffs_dir
# Enrich description with the config file diffs
@description.changed_config_files.each do |file|
@@ -357,8 +358,17 @@
def check_session_for_error
if session[:error]
@errors ||= Array.new
@errors.push(session[:error])
session.clear
+ end
+ end
+
+ def render_exception_title
+ case @error
+ when Machinery::Errors::SystemDescriptionIncompatible
+ return "System Description incompatible!"
+ when Machinery::Errors::SystemDescriptionError
+ return "System Description broken!"
end
end
end