CFx SDK Documentation
2024 SP0
Loading...
Searching...
No Matches
SDK
CFx
dd_inc
Error_WithMessage.h
Go to the documentation of this file.
1
2
// Copyright (C) 2002-2022, Open Design Alliance (the "Alliance").
3
// All rights reserved.
4
//
5
// This software and its documentation and related materials are owned by
6
// the Alliance. The software may only be incorporated into application
7
// programs owned by members of the Alliance, subject to a signed
8
// Membership Agreement and Supplemental Software License Agreement with the
9
// Alliance. The structure and organization of this software are the valuable
10
// trade secrets of the Alliance and its suppliers. The software is also
11
// protected by copyright law and international treaty provisions. Application
12
// programs incorporating this software must include the following statement
13
// with their copyright notices:
14
//
15
// This application incorporates Open Design Alliance software pursuant to a license
16
// agreement with Open Design Alliance.
17
// Open Design Alliance Copyright (C) 2002-2022 by Open Design Alliance.
18
// All rights reserved.
19
//
20
// By use of this software, its documentation or related materials, you
21
// acknowledge and accept the above terms.
23
24
#ifndef _ODERROR_WITHMESSAGE_INCLUDED
25
#define _ODERROR_WITHMESSAGE_INCLUDED
26
27
#include "
OdaCommon.h
"
28
#include "
OdResult.h
"
29
#include "
OdError.h
"
30
31
//creates error with specified code and custom message
32
FIRSTDLL_EXPORT
OdError
OdErrorByCodeAndMessage
(
OdResult
iResCode,
const
char
*iMessage);
33
34
//creates error with specified code and custom message
35
//the message may include formatted parameters
36
FIRSTDLL_EXPORT
OdError
OdErrorByCodeAndMessageFormat
(
OdResult
iResCode,
const
char
*iMessageFormat, ...);
37
38
39
48
#define OD_CHECK_THROW(CONDITION, RESULT_CODE, MESSAGE) \
49
if (CONDITION) {} \
50
else throw OdErrorByCodeAndMessage(RESULT_CODE, MESSAGE);
51
60
#define OD_CHECK_THROW_F(CONDITION, RESULT_CODE, ...) \
61
if (CONDITION) {} \
62
else throw OdErrorByCodeAndMessageFormat(RESULT_CODE, __VA_ARGS__);
63
64
65
//shortcuts for commonly encountered error codes:
66
67
#define OD_CHECKIN_THROW(CONDITION, MESSAGE) OD_CHECK_THROW (CONDITION, eInvalidInput, MESSAGE)
68
#define OD_CHECKIN_THROW_F(CONDITION, ...) OD_CHECK_THROW_F(CONDITION, eInvalidInput, __VA_ARGS__)
69
#define OD_CHECKGMF_THROW(CONDITION, MESSAGE) OD_CHECK_THROW (CONDITION, eGeneralModelingFailure, MESSAGE)
70
#define OD_CHECKGMF_THROW_F(CONDITION, ...) OD_CHECK_THROW_F(CONDITION, eGeneralModelingFailure, __VA_ARGS__)
71
72
#endif
OdErrorByCodeAndMessage
FIRSTDLL_EXPORT OdError OdErrorByCodeAndMessage(OdResult iResCode, const char *iMessage)
OdErrorByCodeAndMessageFormat
FIRSTDLL_EXPORT OdError OdErrorByCodeAndMessageFormat(OdResult iResCode, const char *iMessageFormat,...)
OdError.h
OdResult.h
OdResult
OdResult
Definition:
OdResult.h:29
OdaCommon.h
FIRSTDLL_EXPORT
#define FIRSTDLL_EXPORT
Definition:
RootExport.h:39
OdError
Definition:
OdError.h:43
Generated on Wed Apr 5 2023 17:29:14