1 |
// Subversion Error |
2 |
// |
3 |
// Douglas Thrift |
4 |
// |
5 |
// $Id$ |
6 |
|
7 |
#ifndef _Subversion_Error_hpp_ |
8 |
#define _Subversion_Error_hpp_ |
9 |
|
10 |
#include <cxx/platform.hpp> |
11 |
|
12 |
#ifdef MENES_PRAGMA_ONCE |
13 |
#pragma once |
14 |
#endif |
15 |
|
16 |
#include <api/error.hpp> |
17 |
|
18 |
#include <subversion-1/svn_error.h> |
19 |
|
20 |
namespace Subversion |
21 |
{ |
22 |
|
23 |
struct ApiTraits : public api::ErrorTraits< ::apr_status_t > |
24 |
{ |
25 |
static const unsigned ErrorBase = 10; |
26 |
|
27 |
static const char *GetName() |
28 |
{ |
29 |
return "Subversion"; |
30 |
} |
31 |
|
32 |
static ErrorCode GetLastError() |
33 |
{ |
34 |
throw ext::NotImplementedException(); |
35 |
} |
36 |
|
37 |
static cse::String GetMessage(const ErrorCode &code) |
38 |
{ |
39 |
char message[1024]; |
40 |
|
41 |
return ::svn_strerror(code, message, sizeof (message)); |
42 |
} |
43 |
}; |
44 |
|
45 |
typedef api::ErrorImpl<ApiTraits> Error; |
46 |
|
47 |
_finline void CheckError(::svn_error_t *status) |
48 |
{ |
49 |
if (status) |
50 |
throw Error(status->apr_err); |
51 |
} |
52 |
|
53 |
} |
54 |
|
55 |
#endif//_Subversion_Error_hpp_ |