-
Notifications
You must be signed in to change notification settings - Fork 0
/
Exception.cpp
41 lines (37 loc) · 899 Bytes
/
Exception.cpp
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
/*
* Exception.cpp
* SCMS
*
* Created by poiuy_qwert on 08/07/09.
*
*/
#include "Exception.h"
SCMSError::SCMSError(const char *type, const char *msg, ... ) {
va_list args;
va_start(args, msg);
char tmp[strlen(msg)+1000];
int len = vsprintf(tmp, msg, args);
char *buffer = new char[len+1];
memcpy(buffer, tmp, len);
this->errorMessage = buffer;
va_end(args);
this->errorType = type;
this->fileName = "";
this->lineNumber = 0;
}
SCMSError::SCMSError(const char *file, int line, const char *type, const char *msg, ... ) {
va_list args;
va_start(args, msg);
char tmp[strlen(msg)+1000];
int len = vsprintf(tmp, msg, args);
char *buffer = new char[len+1];
memcpy(buffer, tmp, len);
this->errorMessage = buffer;
va_end(args);
this->fileName = file;
this->lineNumber = line;
this->errorType = type;
}
void SCMSError::set_type(const char *type) {
this->errorType = type;
}