forked from cms-externals/frontier_client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFrontierExceptionMapper.cpp
52 lines (45 loc) · 1.38 KB
/
FrontierExceptionMapper.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
42
43
44
45
46
47
48
49
/*
* frontier client C++ exception mapper
*
* Author: Sinisa Veseli
*
* $Id$
*
* Copyright (c) 2009, FERMI NATIONAL ACCELERATOR LABORATORY
* All rights reserved.
*
* For details of the Fermitools (BSD) license see Fermilab-2009.txt or
* http://fermitools.fnal.gov/about/terms.html
*
*/
#
#include <string>
#include <iostream>
#include <exception>
#include "frontier_client/FrontierException.hpp"
#include "frontier_client/FrontierExceptionMapper.hpp"
namespace frontier {
void FrontierExceptionMapper::throwException(
int errorCode, const std::string& errorMessage) {
switch(errorCode) {
case FrontierErrorCode_InvalidArgument:
throw InvalidArgument(errorMessage);
case FrontierErrorCode_MemoryAllocationFailed:
throw MemoryAllocationFailed(errorMessage);
case FrontierErrorCode_ConfigurationError:
throw ConfigurationError(errorMessage);
case FrontierErrorCode_SystemError:
throw SystemError(errorMessage);
case FrontierErrorCode_NetworkProblem:
throw NetworkProblem(errorMessage);
case FrontierErrorCode_ProtocolError:
throw ProtocolError(errorMessage);
case FrontierErrorCode_ServerError:
throw ServerError(errorMessage);
case FrontierErrorCode_UnknownError:
default:
throw FrontierException(errorMessage, errorCode);
}
throw FrontierException(errorMessage, errorCode);
}
} // namespace frontier