}
catch(boost::property_tree::json_parser::json_parser_error &e)
{
- throw OCException("JSON parse error");
+ throw OCException(GENERAL_JSON_PARSE_FAILED);
}
for(auto& item: payload)
{
if(!(optionID >= MIN_HEADER_OPTIONID && optionID <= MAX_HEADER_OPTIONID))
{
- throw OCException("Error:OptionID valid only from 2048 to 3000 inclusive");
+ throw OCException(OC::Exception::OPTION_ID_RANGE_INVALID);
}
}
{
if(nullptr == p)
{
- throw OCException("nullptr at nil_guard()", OC_STACK_INVALID_PARAM);
+ throw OCException(OC::Exception::NIL_GUARD_NULL, OC_STACK_INVALID_PARAM);
}
// Note that although parameters are being forwarded, std::bind() will make a single copy:
static const std::string INVALID_ARRAY = "Array type should have at least []";
static const std::string STR_NULL_RESPONSE = "Response is NULL";
static const std::string STR_PAYLOAD_OVERFLOW = "Payload overflow";
-
+ static const std::string NIL_GUARD_NULL = "nullptr at nil_guard()";
+ static const std::string GENERAL_JSON_PARSE_FAILED = "JSON Parser Error";
+ static const std::string RESOURCE_UNREG_FAILED = "Unregistering resource failed";
+ static const std::string OPTION_ID_RANGE_INVALID =
+ "Error: OptionID valid only from 2048 to 3000 inclusive.";
static const std::string NO_ERROR = "No Error";
static const std::string RESOURCE_CREATED = "Resource Created";
static const std::string GENERAL_FAULT = "General Fault";
static const std::string MALFORMED_STACK_RESPONSE = "Response from OC_STACK is malformed";
static const std::string UNKNOWN_ERROR = "Unknown Error";
+
}
namespace Error
if(OC_REST_GET == entityHandlerRequest->method)
{
- // TODO Why strings : "GET"??
pRequest->setRequestType(OC::PlatformCommands::GET);
}
else if(OC_REST_PUT == entityHandlerRequest->method)
}
else if(OC_REST_DELETE == entityHandlerRequest->method)
{
- pRequest->setRequestType("DELETE");
+ pRequest->setRequestType(OC::PlatformCommands::DELETE);
}
}
}
}
else
{
- throw OCException("Unregistering resource failed", result);
+ throw OCException(OC::Exception::RESOURCE_UNREG_FAILED, result);
}
}
else