[
https://issues.apache.org/jira/browse/DTACLOUD-360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13502764#comment-13502764
]
Michal Fojtik commented on DTACLOUD-360:
----------------------------------------
So I did a quick testing:
This is what I have in mock driver:
def realms(credentials, opts={})
...
safely do
# This hack is used to test if client capture exceptions correctly
# To raise an exception do GET /api/realms/50[0-2]
raise "DeltacloudErrorTest" if opts and opts[:id] == "500"
end
...
end
on /DeltacloudErrorTest/ do
status 500
#message "DeltacloudErrorMessage" => This will overide the exception
message (I disabled that)
end
Then I did: curl -x GET --user 'mockuser:mockpassword'
'http://localhost:3001/api/realms/500'
This is what I can see in the console:
127.0.0.1 - - [22/Nov/2012 14:16:59] "GET /api/realms/500 HTTP/1.1" 500 696355
0.3380
E, [2012-11-22T14:17:00.449709 #12424] ERROR -- 500:
[Deltacloud::Exceptions::BackendError] DeltacloudErrorTest
/home/mfojtik/code/core/server/lib/deltacloud/drivers/mock/mock_driver.rb:104:in
`realms'
/home/mfojtik/code/core/server/lib/deltacloud/drivers/exceptions.rb:212:in
`call'
/home/mfojtik/code/core/server/lib/deltacloud/drivers/exceptions.rb:212:in
`safely'
/home/mfojtik/code/core/server/lib/deltacloud/drivers/mock/mock_driver.rb:101:in
`realms'
/home/mfojtik/code/core/server/lib/deltacloud/drivers/base_driver.rb:218:in
`realm'
/home/mfojtik/code/core/server/lib/deltacloud/helpers/deltacloud_helper.rb:69:in
`send'
/home/mfojtik/code/core/server/lib/deltacloud/helpers/deltacloud_helper.rb:69:in
`show'
/home/mfojtik/.rbenv/versions/1.8.7-p370/lib/ruby/1.8/benchmark.rb:293:in
`measure'
/home/mfojtik/code/core/server/lib/deltacloud/helpers/deltacloud_helper.rb:68:in
`show'
/home/mfojtik/code/core/server/lib/deltacloud/helpers/rabbit_helper.rb:29:in
`standard_show_operation'
/home/mfojtik/.rbenv/versions/1.8.7-p370/lib/ruby/gems/1.8/gems/sinatra-rabbit-1.1.2/lib/sinatra/rabbit/base.rb:394:in
`instance_eval'
The 'DeltacloudErrorTest' is the original message I used in 'raise'.
> console does not print "Blah" when safely { raise "Blah" }, then capture that
> by exceptions {}
> ----------------------------------------------------------------------------------------------
>
> Key: DTACLOUD-360
> URL: https://issues.apache.org/jira/browse/DTACLOUD-360
> Project: DeltaCloud
> Issue Type: Bug
> Components: Server
> Environment: Win 7
> Reporter: Dies Koper
> Assignee: Michal Fojtik
>
> All it logs to the console is the return code, like an access log entry, but
> not the exception message. It used to print the message too.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira