49179d824c5d36779525ca0825254bfa9afd0fe4
[platform/upstream/syncevolution.git] / src / synthesis / src / sysync / syncexception.cpp
1 /*
2  *  File:         SyncException.cpp
3  *
4  *  Author:       Lukas Zeller (luz@synthesis.ch)
5  *
6  *  TSyncException...
7  *    SySync Exception classes
8  *
9  *  Copyright (c) 2001-2009 by Synthesis AG (www.synthesis.ch)
10  *
11  *  2001-05-28 : luz : created
12  *
13  */
14
15 // includes
16 #include "prefix_file.h"
17
18 #include "sysync.h"
19 #include "syncexception.h"
20
21
22
23 using namespace sysync;
24
25
26
27 TSyncException::TSyncException(const char *aMsg1, localstatus aLocalStatus) NOTHROW
28 {
29   fMessage = aMsg1;
30   fLocalStatus = aLocalStatus;
31 } // TSyncException::TSyncException
32
33
34 TSyncException::TSyncException(localstatus aLocalStatus) NOTHROW
35 {
36   fLocalStatus = aLocalStatus;
37   fMessage = "Exception due to local error status";
38 } // TSyncException::TSyncException
39
40
41 TSyncException::~TSyncException() NOTHROW
42 {
43 } // TSyncException::~TSyncException
44
45
46 const char *TSyncException::what() const  NOTHROW
47 {
48   return fMessage.c_str();
49 } // TSyncException::getMessage
50
51
52 void TSyncException::setMsg(const char *p)
53 {
54   fMessage=p;
55 } // TSyncException::setMsg
56
57
58
59
60 TSmlException::TSmlException(const char *aMsg, Ret_t aSmlError) NOTHROW
61 {
62   const int msgsiz=256;
63   char msg[msgsiz];
64
65   fSmlError=aSmlError;
66   msg[0]=0;
67   snprintf(msg,msgsiz,"SyncML Toolkit error=0x%04hX, %s",(uInt16)fSmlError,aMsg);
68   setMsg(msg);
69 } // TSmlException::TSmlException
70
71
72 // eof