1 /*---------------------------------------------------------------------------*
2   Project:  Horizon
3   File:     os_ErrorHandlerSelect.h
4 
5   Copyright (C)2009-2012 Nintendo Co., Ltd.  All rights reserved.
6 
7   These coded instructions, statements, and computer programs contain
8   proprietary information of Nintendo of America Inc. and/or Nintendo
9   Company Ltd., and are protected by Federal copyright law.  They may
10   not be disclosed to third parties or copied or duplicated in any form,
11   in whole or in part, without the prior written consent of Nintendo.
12 
13   $Rev:$
14  *---------------------------------------------------------------------------*/
15 
16 #ifndef NN_OS_OS_ERRORHANDLERSELECT_H_
17 #define NN_OS_OS_ERRORHANDLERSELECT_H_
18 
19 #ifdef __cplusplus
20 
21 #ifdef NN_PLATFORM_CTR
22     #include <nn/os/CTR/os_ErrorHandler.h>
23 
24     namespace nn { namespace os { namespace detail {
25         using nn::os::CTR::detail::HandleInternalError;
26         using nn::os::CTR::detail::SetInternalErrorHandlingMode;
27     }}}
28 
29 #else
30     #error NN_PROCESSOR not specified
31 #endif
32 
33 #endif /* __cplusplus */
34 
35 
36 
37 #ifdef NN_SWITCH_DISABLE_DEBUG_PRINT
38 #define NN_OS_ERROR_IF_FAILED(result)           \
39     do                                          \
40     {                                           \
41         ::nn::Result nn_os_result = (result);   \
42         if ( nn_os_result.IsFailure() )         \
43         {                                       \
44             ::nn::os::detail::HandleInternalError(nn_os_result); \
45         }                                       \
46     } while(0)
47 
48 #else  /* NN_SWITCH_DISABLE_DEBUG_PRINT */
49 #define NN_OS_ERROR_IF_FAILED(result)           \
50     do                                          \
51     {                                           \
52         ::nn::Result nn_os_result = (result);   \
53         if ( nn_os_result.IsFailure() )         \
54         {                                       \
55             ::nn::os::detail::HandleInternalError(nn_os_result, NN_FILE_NAME, __LINE__); \
56         }                                       \
57     } while(0)
58 
59 #endif /* NN_SWITCH_DISABLE_DEBUG_PRINT */
60 
61 
62 #endif /* NN_OS_OS_ERRORHANDLERSELECT_H_ */
63