From 20a0a78184f56b98d15c5d5734c20c372e615402 Mon Sep 17 00:00:00 2001 From: Daniel Molina Date: Fri, 14 Oct 2011 15:51:52 +0200 Subject: [PATCH] feature #873: Add mapping for errno to HTTP codes --- src/cloud/common/CloudServer.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/cloud/common/CloudServer.rb b/src/cloud/common/CloudServer.rb index 91c5335701..59ad085e7f 100755 --- a/src/cloud/common/CloudServer.rb +++ b/src/cloud/common/CloudServer.rb @@ -22,6 +22,18 @@ require 'CloudAuth' # API (OCA). Any cloud implementation should derive from this class ############################################################################## class CloudServer + ########################################################################## + # Class Constants. Define the OpenNebula Error and HTTP codes mapping + ########################################################################## + HTTP_ERROR_CODE = { + OpenNebula::Error::EAUTHENTICATION => 401, + OpenNebula::Error::EAUTHORIZATION => 403, + OpenNebula::Error::ENO_EXISTS => 404, + OpenNebula::Error::EACTION => 500, + OpenNebula::Error::EXML_RPC_API => 500, + OpenNebula::Error::EINTERNAL => 500, + OpenNebula::Error::ENOTDEFINED => 500 + } ########################################################################## # Public attributes