-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathErrorResponse.cpp
More file actions
76 lines (51 loc) · 1.66 KB
/
ErrorResponse.cpp
File metadata and controls
76 lines (51 loc) · 1.66 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
///////////////////////////////////////////////////////////
// ErrorResponse.cpp
// Implementation of the Class ErrorResponse
// Created on: 30-Sau-2014 17:06:18
// Original author: Povilas
///////////////////////////////////////////////////////////
#define _ELPP_THREAD_SAFE
#define _ELPP_STL_LOGGING
#define _ELPP_NO_DEFAULT_LOG_FILE
#include "ErrorResponse.h"
#include "logging/easylogging++.h"
std::string ErrorResponse::faultString = "Damis error";
std::string ErrorResponse::faultDetail = "";
bool ErrorResponse::fault = false;
ErrorResponse::ErrorResponse(){
}
ErrorResponse::~ErrorResponse(){
}
/**
* Method returns fault string
*/
std::string ErrorResponse::getFaultString(){
return ErrorResponse::faultString;
}
/**
* Method that returns fault detail
*/
std::string ErrorResponse::getFaultDetail(){
return ErrorResponse::faultDetail;
}
void ErrorResponse::setFaultDetail(std::string detail, bool append){
LOG(INFO) << "Initiating set FaultDetail function, got fault detail: " << detail << ". Append " << append;
if (!ErrorResponse::fault)
ErrorResponse::fault = true;
if (append == false && !detail.empty())
ErrorResponse::faultDetail = detail;
if (append && !detail.empty() && ErrorResponse::faultDetail.empty())
ErrorResponse::faultDetail = detail;
else if (append && !detail.empty() && !ErrorResponse::faultDetail.empty())
{
ErrorResponse::faultDetail +=" ";
ErrorResponse::faultDetail += detail;
ErrorResponse::faultDetail += ".";
}
}
/**
* Returns true/false if fault has been found
*/
bool ErrorResponse::isFaultFound(){
return ErrorResponse::fault;
}