acme
Foundational cross-platform layer of the ca2 framework
Loading...
Searching...
No Matches
exception2.h
1#pragma once
2
3
4#include "acme/operating_system/shared_posix/c_errno.h"
5
6
7#define C_RUNTIME_ERROR_CHECK(expr) ::c_errno::s_throw_exception(expr)
8#ifndef C_RUNTIME_ERRORCHECK_SPRINTF
9#define C_RUNTIME_ERRORCHECK_SPRINTF(expr) \
10do { \
11 errno_t _saveErrno = errno; \
12 errno = 0; \
13 (expr); \
14 if(0 != errno) \
15 { \
16 ::c_runtime_error_check(errno); \
17 } \
18 else \
19 { \
20 errno = _saveErrno; \
21 } \
22} while (0)
23#endif // C_RUNTIME_ERRORCHECK_SPRINTF
24
25
26//CLASS_DECL_ACME c_errno c_runtime_error_check(c_errno error);
27//{
28// switch(error)
29// {
30// case ENOMEM:
31// throw ::exception(error_no_memory);
32// break;
33// case EINVAL:
34// case ERANGE:
35// throw ::exception(error_bad_argument);
36// break;
37//#if defined(WINDOWS)
38// case STRUNCATE:
39//#endif
40// case 0:
41// break;
42// default:
43// throw ::exception(error_bad_argument);
44// break;
45// }
46// return error;
47//}
48
49
50
51
52
53