From: Michal Fojtik <[email protected]> The exception handling DSL we're using allow user to define custom exception message using the 'message' directive. This message is then used in XML/HTML view and client can fetch it. However DC logs the original error message to system log. This patch should make DC log user-defined message to log.
Signed-off-by: Michal fojtik <[email protected]> --- server/lib/deltacloud/base_driver/exceptions.rb | 5 +++-- 1 files changed, 3 insertions(+), 2 deletions(-) diff --git a/server/lib/deltacloud/base_driver/exceptions.rb b/server/lib/deltacloud/base_driver/exceptions.rb index e30f94c..08f2683 100644 --- a/server/lib/deltacloud/base_driver/exceptions.rb +++ b/server/lib/deltacloud/base_driver/exceptions.rb @@ -175,9 +175,10 @@ module Deltacloud report_method = $stderr.respond_to?(:err) ? :err : :puts Deltacloud::ExceptionHandler::exceptions.each do |exdef| if exdef.match?($!) - $stderr.send(report_method, "#{[$!.class.to_s, $!.message].join(':')}\n#{$!.backtrace.join("\n")}") new_exception = exdef.handler($!) - raise exdef.handler($!) if new_exception + m = new_exception.message.nil? ? $1.message : new_exception.message + $stderr.send(report_method, "#{[$!.class.to_s, m].join(':')}\n#{$!.backtrace[0..10].join("\n")}") + raise exdef.handler($!) unless new_exception.nil? end end $stderr.send(report_method, "[NO HANDLED] #{[$!.class.to_s, $!.message].join(': ')}\n#{$!.backtrace.join("\n")}") -- 1.7.9.1
