/*---------------------------------------------------------------------------* Project: Horizon File: err_Api.h Copyright (C)2010 Nintendo Co., Ltd. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 38846 $ *---------------------------------------------------------------------------*/ #ifndef NN_ERR_CTR_ERR_API_H_ #define NN_ERR_CTR_ERR_API_H_ #include #include #ifdef __cplusplus namespace nn { namespace err { namespace CTR { // On the development hardware, when an error occurs in the library, instead of stopping, it is treated as a fatal error. // void SetupResultHandler( void ); // Do not directly call the following function. Use the NN_ERR_THROW_* macro. void ThrowFatalErr( Result result ); void ThrowFatalErrAll( Result result ); }}} // namespace nn::err::CTR #ifndef NN_HARDWARE_CTR_LEGACY #ifdef NN_PROCESSOR_ARM11MPCORE /* A FATAL error is thrown to the error display applet. An actual notification occurs only when the Result's LEVEL is FATAL. */ #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ do \ { \ ::nn::Result resultLocal = (result); \ if ( resultLocal.GetLevel() == ::nn::Result::LEVEL_FATAL ) \ { \ ::nn::err::ThrowFatalErrAll(resultLocal); \ } \ } while(0) /* A FATAL error is thrown to the error display applet. An actual notification occurs when the Result LEVEL is not SUCCESS/STATUS/INFO (not recommended) (for fatal errors or errors that should not occur on the production device). */ #define NN_ERR_THROW_FATAL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ if ( resultLocal.IsFailure() ) \ { \ ::nn::err::ThrowFatalErr(resultLocal); \ } \ } while(0) /* A FATAL error is thrown to the error display applet. Notifies for all Results that are errors. */ #define NN_ERR_THROW_FATAL_ALL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ if ( resultLocal.IsFailure() ) \ { \ ::nn::err::ThrowFatalErrAll(resultLocal); \ } \ } while(0) #else /* NN_PROCESSOR_ARM11MPCORE */ #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) NN_UTIL_PANIC_IF_FAILED(result) #define NN_ERR_THROW_FATAL(result) NN_UTIL_PANIC_IF_FAILED(result) #define NN_ERR_THROW_FATAL_ALL(result) NN_UTIL_PANIC_IF_FAILED(result) #endif /* NN_PROCESSOR_ARM11MPCORE */ #else /* NN_HARDWARE_CTR_LEGACY */ #define NN_ERR_THROW_FATAL_IF_FATAL_ONLY(result) \ do \ { \ ::nn::Result resultLocal = (result); \ NN_UNUSED_VAR(resultLocal); \ } while(0) #define NN_ERR_THROW_FATAL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ NN_UNUSED_VAR(resultLocal); \ } while(0) #define NN_ERR_THROW_FATAL_ALL(result) \ do \ { \ ::nn::Result resultLocal = (result); \ NN_UNUSED_VAR(resultLocal); \ } while(0) #endif /* NN_HARDWARE_CTR_LEGACY */ #endif // __cplusplus #endif /* NN_ERR_CTR_ERR_API_H_ */