You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@libcloud.apache.org by "Brian Hoenig (JIRA)" <ji...@apache.org> on 2011/09/23 20:18:26 UTC

[dev] [jira] [Created] (LIBCLOUD-114) Provider HTTP Error responses need to be propagated in a better way.

Provider HTTP Error responses need to be propagated in a better way.
--------------------------------------------------------------------

                 Key: LIBCLOUD-114
                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-114
             Project: Libcloud
          Issue Type: Improvement
          Components: Core
            Reporter: Brian Hoenig
            Priority: Minor


Currently when a provider returns an unexpected (error) response the response code and message must be parsed from a message string in a base Exception.  Instead we should include the error code and error message in an exception class (ProviderHTTPResponseError).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[dev] [jira] [Commented] (LIBCLOUD-114) Provider HTTP Error responses need to be propagated in a better way.

Posted by "Tomaz Muraus (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LIBCLOUD-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114027#comment-13114027 ] 

Tomaz Muraus commented on LIBCLOUD-114:
---------------------------------------

Can you provide a concreate example please?

You should be able to handle cases like this in a custom _Response_ class.

> Provider HTTP Error responses need to be propagated in a better way.
> --------------------------------------------------------------------
>
>                 Key: LIBCLOUD-114
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-114
>             Project: Libcloud
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Brian Hoenig
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Currently when a provider returns an unexpected (error) response the response code and message must be parsed from a message string in a base Exception.  Instead we should include the error code and error message in an exception class (ProviderHTTPResponseError).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[dev] [jira] [Issue Comment Edited] (LIBCLOUD-114) Provider HTTP Error responses need to be propagated in a better way.

Posted by "Tomaz Muraus (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LIBCLOUD-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114027#comment-13114027 ] 

Tomaz Muraus edited comment on LIBCLOUD-114 at 9/24/11 5:58 PM:
----------------------------------------------------------------

Can you provide a concreate example please?

You should be able to handle cases like this in a custom Response class.

      was (Author: kami):
    Can you provide a concreate example please?

You should be able to handle cases like this in a custom _Response_ class.
  
> Provider HTTP Error responses need to be propagated in a better way.
> --------------------------------------------------------------------
>
>                 Key: LIBCLOUD-114
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-114
>             Project: Libcloud
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Brian Hoenig
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Currently when a provider returns an unexpected (error) response the response code and message must be parsed from a message string in a base Exception.  Instead we should include the error code and error message in an exception class (ProviderHTTPResponseError).

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[dev] [jira] [Commented] (LIBCLOUD-114) Provider HTTP Error responses need to be propagated in a better way.

Posted by "Brian Hoenig (Commented) (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/LIBCLOUD-114?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13114965#comment-13114965 ] 

Brian Hoenig commented on LIBCLOUD-114:
---------------------------------------

Sure, this is to handle and response from a provider that fails the drivers success test.

A good example is attempting to save an image on a node that is busy:
------------------
In [8]: lcProvider.ex_save_image(lcNode,'spam')
Out[8]: <NodeImage: id=10246636, name=spam, driver=Rackspace (UK)  ...>

In [9]: lcProvider.ex_save_image(lcNode,'spam')

......
Exception: 400 Bad Request 422 Unprocessable Entity: Cannot create a new backup request while saving a prior backup or migrating.; com.rackspace.cloud.service.servers.CloudServersFault: Fault occured
---------------------

The response information is valuable and has to be parsed from a string, and that string is currently constructed differently for every provider. It would be nice for the caller to get that code in a uniform way across providers.  I understand that this can be handled with a custom response class (and is for auth errors in a variety of ways for some providers), but it would be much more useful and keep things more consistent to propagate the provider response.  The  new exception class would allow things like this:


--------------------------

In [18]: try:
   ....:     lcNode.id = "23676"
   ....:     lcProvider.ex_save_image(lcNode,'spam')
   ....: except ProviderHTTPResponseError, e:
   ....:     print str(e)
   ....:     print
   ....:     print "Code: %s" % e.http_error_code
   ....:     print
   ....:     print "Message: %s" % e.http_error_message
   ....:     

404 Not Found Not Found; com.rackspace.cloud.service.servers.ItemNotFoundFault:  Not Found

Code: 404

Message: Not Found

-----------------------
                
> Provider HTTP Error responses need to be propagated in a better way.
> --------------------------------------------------------------------
>
>                 Key: LIBCLOUD-114
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-114
>             Project: Libcloud
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Brian Hoenig
>            Priority: Minor
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Currently when a provider returns an unexpected (error) response the response code and message must be parsed from a message string in a base Exception.  Instead we should include the error code and error message in an exception class (ProviderHTTPResponseError).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[dev] [jira] [Updated] (LIBCLOUD-114) Provider HTTP Error responses need to be propagated in a better way.

Posted by "Brian Hoenig (Updated) (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/LIBCLOUD-114?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Brian Hoenig updated LIBCLOUD-114:
----------------------------------

    Attachment: LIBCLOUD-114.patch
    
> Provider HTTP Error responses need to be propagated in a better way.
> --------------------------------------------------------------------
>
>                 Key: LIBCLOUD-114
>                 URL: https://issues.apache.org/jira/browse/LIBCLOUD-114
>             Project: Libcloud
>          Issue Type: Improvement
>          Components: Core
>            Reporter: Brian Hoenig
>            Priority: Minor
>         Attachments: LIBCLOUD-114.patch
>
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> Currently when a provider returns an unexpected (error) response the response code and message must be parsed from a message string in a base Exception.  Instead we should include the error code and error message in an exception class (ProviderHTTPResponseError).

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira