/*---------------------------------------------------------------------------* Project: Horizon File: os_ErrorHandler.cpp Copyright (C)2009-2011 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: 38267 $ *---------------------------------------------------------------------------*/ #include #include #include #include #include namespace nn { namespace os { namespace CTR { namespace detail { #if ( defined(NN_PROCESSOR_ARM11MPCORE) && !defined(NN_HARDWARE_CTR_LEGACY) ) namespace { bool s_PreferFatal = true; } #endif // Internal error handler for the os library (with source debug information) void InternalErrorHandler( Result result, const char* filename, int lineno ) { #if ( defined(NN_PROCESSOR_ARM11MPCORE) && !defined(NN_HARDWARE_CTR_LEGACY) ) Result::Level level = result.GetLevel(); if ( nn::os::IsRunOnDevelopmentHardware() && !s_PreferFatal ) { if ( level == Result::LEVEL_FATAL ) { nn::err::ThrowFatalErr(result, NN_ERR_FATAL_TYPE_SYSTEM_COMMON, __return_address()); } nnResultTFailureHandler(result, filename, lineno, "Unexpected Result Failure."); } else { switch ( level ) { case Result::LEVEL_STATUS: case Result::LEVEL_INFO: break; default: nn::err::ThrowFatalErr(result, NN_ERR_FATAL_TYPE_SYSTEM_COMMON, __return_address()); } } #else nnResultTFailureHandler(result, filename, lineno, "Unexpected Result Failure."); #endif } // Internal error handler for the os library (without source debug information) void InternalErrorHandler( Result result ) { #if ( defined(NN_PROCESSOR_ARM11MPCORE) && !defined(NN_HARDWARE_CTR_LEGACY) ) Result::Level level = result.GetLevel(); if ( nn::os::IsRunOnDevelopmentHardware() && !s_PreferFatal ) { if ( level == Result::LEVEL_FATAL ) { nn::err::ThrowFatalErr(result, NN_ERR_FATAL_TYPE_SYSTEM_COMMON, __return_address()); } nnResultTFailureHandler(result, "", 0, ""); } else { switch ( level ) { case Result::LEVEL_STATUS: case Result::LEVEL_INFO: break; default: nn::err::ThrowFatalErr(result, NN_ERR_FATAL_TYPE_SYSTEM_COMMON, __return_address()); } } #else nnResultTFailureHandler(result, "", 0, ""); #endif } // Change mode of the internal error handler for os library void SetInternalErrorHandlerMode( bool preferFatal ) { #if ( defined(NN_PROCESSOR_ARM11MPCORE) && !defined(NN_HARDWARE_CTR_LEGACY) ) s_PreferFatal = preferFatal; #else NN_UNUSED_VAR(preferFatal); #endif } }}}} // nn::os::CTR::detail