<div dir="ltr"><div class="gmail_default" style="font-size:large"><p style="line-height:1.15;margin-top:0pt;margin-bottom:0pt" id="docs-internal-guid-e59241ee-3682-daf7-6af2-b0286da6b0d7"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Hi, all<br></span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"><br></span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Openstack APIs interact with each other and external systems partially by passing of HTTP errors. The only valuable difference between types of exceptions is HTTP-codes, but current codes are generalized, so external system can’t distinguish what actually happened. </span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">As an example two different failures below differs only by error message:</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">request:</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">POST /v2/790f5693e97a40d38c4d5bfdc45acb09/servers HTTP/1.1</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Host: <a href="http://192.168.122.195:8774">192.168.122.195:8774</a></span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">X-Auth-Project-Id: demo</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Accept-Encoding: gzip, deflate, compress</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Length: 189</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Accept: application/json</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">User-Agent: python-novaclient</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">X-Auth-Token: 2cfeb9283d784cfba694f3122ef413bf</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Type: application/json</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">{"server": {"name": "demo", "imageRef": "171c9d7d-3912-4547-b2a5-ea157eb08622", "key_name": "test", "flavorRef": "42", "max_count": 1, "min_count": 1, "security_groups": [{"name": "bar"}]}}</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline"></span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">response:</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">    </span><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">HTTP/1.1 400 Bad Request</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Length: 118</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Type: application/json; charset=UTF-8</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">X-Compute-Request-Id: req-a995e1fc-7ea4-4305-a7ae-c569169936c0</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Date: Fri, 23 Jan 2015 10:43:33 GMT</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">{"badRequest": {"message": "Security group bar not found for project 790f5693e97a40d38c4d5bfdc45acb09.", "code": 400}}</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">and</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">request:</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">POST /v2/790f5693e97a40d38c4d5bfdc45acb09/servers HTTP/1.1</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Host: <a href="http://192.168.122.195:8774">192.168.122.195:8774</a></span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">X-Auth-Project-Id: demo</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Accept-Encoding: gzip, deflate, compress</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Length: 192</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Accept: application/json</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">User-Agent: python-novaclient</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">X-Auth-Token: 24c0d30ff76c42e0ae160fa93db8cf71</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Type: application/json</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">{"server": {"name": "demo", "imageRef": "171c9d7d-3912-4547-b2a5-ea157eb08622", "key_name": "foo", "flavorRef": "42", "max_count": 1, "min_count": 1, "security_groups": [{"name": "default"}]}}</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">response:</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">HTTP/1.1 400 Bad Request</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Length: 70</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Content-Type: application/json; charset=UTF-8</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">X-Compute-Request-Id: req-87604089-7071-40a7-a34b-7bc56d0551f5</span></p><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Date: Fri, 23 Jan 2015 10:39:43 GMT</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt;margin-left:36pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">{"badRequest": {"message": "Invalid key_name provided.", "code": 400}}</span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">The former specifies an incorrect security group name, and the latter an incorrect keypair name. And the problem is, that just looking at the response body and HTTP response code an external system can’t understand what exactly went wrong. And parsing of error messages here is not the way we’d like to solve this problem. </span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">Another example for solving this problem is AWS EC2 exception codes [1] </span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">So if we have some service based on Openstack projects it would be useful to have some concrete error codes(textual or numeric), which could allow to define what actually goes wrong and later correctly process obtained exception. These codes should be predefined for each exception, have documented structure and allow to parse exception correctly in each step of exception handling. </span></p><br><p dir="ltr" style="line-height:1.15;margin-top:0pt;margin-bottom:0pt"><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">So I’d like to discuss implementing such codes and its usage in openstack projects.</span></p><br><span style="font-size:15px;font-family:Arial;color:rgb(0,0,0);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:none;vertical-align:baseline">[1] - </span><a href="http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html" style="text-decoration:none"><span style="font-size:15px;font-family:Arial;color:rgb(17,85,204);background-color:transparent;font-weight:normal;font-style:normal;font-variant:normal;text-decoration:underline;vertical-align:baseline">http://docs.aws.amazon.com/AWSEC2/latest/APIReference/errors-overview.html</span></a></div></div>