22#ifndef DXCPP_EXCEPTIONS_H
23#define DXCPP_EXCEPTIONS_H
27#include <boost/lexical_cast.hpp>
33 namespace DXErrorTypes {
34 static const std::string DEFAULT_ERROR =
"DXDefaultError";
35 static const std::string DXFILE_ERROR =
"DXFileError";
36 static const std::string DXAPP_ERROR =
"DXAppError";
37 static const std::string DXJOB_ERROR =
"DXJobError";
38 static const std::string DXCONNECTION_ERROR =
"DXConnectionError";
39 static const std::string DXNOT_IMPLEMENTED_ERROR =
"DXNotImplementedError";
47 mutable std::string error_msg;
49 DXError():
msg(
"Unknown error occured while using dxcpp.") { }
51 virtual const char* what()
const throw() {
52 error_msg =
type +
": '" +
msg +
"'";
53 return (
const char*)
msg.c_str();
56 virtual ~DXError() throw() { }
71 virtual const char* what()
const throw() {
72 error_msg =
type +
": '" +
msg +
"', Server returned HTTP code '" + boost::lexical_cast<std::string>(
resp_code) +
"'";
73 return (
const char*)error_msg.c_str();
76 virtual ~DXAPIError() throw() { }
86 virtual const char* what()
const throw() {
87 error_msg =
type +
": '" +
msg +
"', Curl error code = '" + boost::lexical_cast<std::string>(
curl_code) +
"'";
88 return (
const char*)error_msg.c_str();
91 virtual ~DXConnectionError() throw() { }
Definition exceptions.h:64
int resp_code
HTTP status code returned by the apiserver.
Definition exceptions.h:66
Represents errors relating to the DXApp class.
Definition exceptions.h:104
Definition exceptions.h:79
int curl_code
Curl code (returned by libcurl)
Definition exceptions.h:81
Generic exception for the DNAnexus C++ library.
Definition exceptions.h:43
std::string type
Type of the error message (can be a free-form string, but usually one of the static members from DXEr...
Definition exceptions.h:46
std::string msg
The actual error message.
Definition exceptions.h:45
Represents errors relating to the DXFile class.
Definition exceptions.h:95
Represents errors relating to the DXJob class.
Definition exceptions.h:113
Definition exceptions.h:125
An executable object that can be published for others to discover.
Definition api.cc:7