libnx  v4.2.2
Data Structures | Enumerations | Functions
error.h File Reference

Wrapper for using the error LibraryApplet. More...

#include "../types.h"
#include "../services/set.h"

Go to the source code of this file.

Data Structures

struct  ErrorCode
 Stores error-codes which are displayed as XXXX-XXXX, low for the former and desc for the latter. More...
 
struct  ErrorContext
 Error context. More...
 
struct  ErrorCommonHeader
 Common header for the start of the arg storage. More...
 
struct  ErrorCommonArg
 Common error arg data. More...
 
struct  ErrorPctlArg
 Error arg data for certain errors with module PCTL. More...
 
struct  ErrorResultBacktrace
 ResultBacktrace. More...
 
struct  ErrorEulaArg
 Error arg data for EULA. More...
 
struct  ErrorEulaData
 Additional input storage data for errorSystemUpdateEulaShow. More...
 
struct  ErrorRecordArg
 Error arg data for Record. More...
 
struct  ErrorSystemArg
 SystemErrorArg. More...
 
struct  ErrorSystemConfig
 Error system config. More...
 
struct  ErrorApplicationArg
 ApplicationErrorArg. More...
 
struct  ErrorApplicationConfig
 Error application config. More...
 

Enumerations

enum  ErrorType {
  ErrorType_Normal = 0,
  ErrorType_System = 1,
  ErrorType_Application = 2,
  ErrorType_Eula = 3,
  ErrorType_Pctl = 4,
  ErrorType_Record = 5,
  ErrorType_SystemUpdateEula = 8
}
 Error type for ErrorCommonHeader.type. More...
 
enum  ErrorContextType {
  ErrorContextType_None = 0,
  ErrorContextType_Http = 1,
  ErrorContextType_FileSystem = 2,
  ErrorContextType_WebMediaPlayer = 3,
  ErrorContextType_LocalContentShare = 4
}
 Error type for ErrorContext.type. More...
 

Functions

static ErrorCode errorCodeCreate (u32 low, u32 desc)
 Creates an ErrorCode. More...
 
static ErrorCode errorCodeCreateResult (Result res)
 Creates an ErrorCode with the input Result. More...
 
static ErrorCode errorCodeCreateInvalid (void)
 Creates an invalid ErrorCode.
 
static bool errorCodeIsValid (ErrorCode errorCode)
 Checks whether the input ErrorCode is valid. More...
 
Result errorResultShow (Result res, bool jumpFlag, const ErrorContext *ctx)
 Launches the applet for displaying the specified Result. More...
 
Result errorCodeShow (ErrorCode errorCode, bool jumpFlag, const ErrorContext *ctx)
 Launches the applet for displaying the specified ErrorCode. More...
 
Result errorResultBacktraceCreate (ErrorResultBacktrace *backtrace, s32 count, const Result *entries)
 Creates an ErrorResultBacktrace struct. More...
 
Result errorResultBacktraceShow (Result res, const ErrorResultBacktrace *backtrace)
 Launches the applet for ErrorResultBacktrace. More...
 
Result errorEulaShow (SetRegion RegionCode)
 Launches the applet for displaying the EULA. More...
 
Result errorSystemUpdateEulaShow (SetRegion RegionCode, const ErrorEulaData *eula)
 Launches the applet for displaying the system-update EULA. More...
 
Result errorCodeRecordShow (ErrorCode errorCode, u64 timestamp)
 Launches the applet for displaying an error full-screen, using the specified ErrorCode and timestamp. More...
 
static Result errorResultRecordShow (Result res, u64 timestamp)
 Launches the applet for displaying an error full-screen, using the specified Result and timestamp. More...
 
Result errorSystemCreate (ErrorSystemConfig *c, const char *dialog_message, const char *fullscreen_message)
 Creates an ErrorSystemConfig struct. More...
 
Result errorSystemShow (ErrorSystemConfig *c)
 Launches the applet with the specified config. More...
 
static void errorSystemSetCode (ErrorSystemConfig *c, ErrorCode errorCode)
 Sets the error code. More...
 
static void errorSystemSetResult (ErrorSystemConfig *c, Result res)
 Sets the error code, using the input Result. More...
 
static void errorSystemSetLanguageCode (ErrorSystemConfig *c, u64 LanguageCode)
 Sets the LanguageCode. More...
 
void errorSystemSetContext (ErrorSystemConfig *c, const ErrorContext *ctx)
 Sets the ErrorContext. More...
 
Result errorApplicationCreate (ErrorApplicationConfig *c, const char *dialog_message, const char *fullscreen_message)
 Creates an ErrorApplicationConfig struct. More...
 
Result errorApplicationShow (ErrorApplicationConfig *c)
 Launches the applet with the specified config. More...
 
static void errorApplicationSetNumber (ErrorApplicationConfig *c, u32 errorNumber)
 Sets the error code number. More...
 
static void errorApplicationSetLanguageCode (ErrorApplicationConfig *c, u64 LanguageCode)
 Sets the LanguageCode. More...
 

Detailed Description

Wrapper for using the error LibraryApplet.

Author
StuntHacks, yellows8

Enumeration Type Documentation

◆ ErrorContextType

Error type for ErrorContext.type.

Enumerator
ErrorContextType_None 

None.

ErrorContextType_Http 

Http.

ErrorContextType_FileSystem 

FileSystem.

ErrorContextType_WebMediaPlayer 

WebMediaPlayer.

ErrorContextType_LocalContentShare 

LocalContentShare.

◆ ErrorType

enum ErrorType

Error type for ErrorCommonHeader.type.

Enumerator
ErrorType_Normal 

Normal.

ErrorType_System 

System.

ErrorType_Application 

Application.

ErrorType_Eula 

EULA.

ErrorType_Pctl 

Parental Controls.

ErrorType_Record 

Record.

ErrorType_SystemUpdateEula 

SystemUpdateEula.

Function Documentation

◆ errorApplicationCreate()

Result errorApplicationCreate ( ErrorApplicationConfig c,
const char *  dialog_message,
const char *  fullscreen_message 
)

Creates an ErrorApplicationConfig struct.

Parameters
cErrorApplicationConfig struct.
dialog_messageUTF-8 dialog message.
fullscreen_messageUTF-8 fullscreen message, displayed when the user clicks on "Details". Optional, can be NULL (which disables displaying Details).
Note
Sets the following fields: jumpFlag=1, {strings}, and uses ErrorType_Application. The rest are cleared.
On pre-5.0.0 this will initialize languageCode by using: setInitialize(), setMakeLanguageCode(SetLanguage_ENUS, ...), and setExit(). This is needed since an empty languageCode wasn't supported until [5.0.0+] (which would also use SetLanguage_ENUS).
Warning
This applet creates an error report that is logged in the system. Proceed at your own risk!

◆ errorApplicationSetLanguageCode()

static void errorApplicationSetLanguageCode ( ErrorApplicationConfig c,
u64  LanguageCode 
)
inlinestatic

Sets the LanguageCode.

Parameters
cErrorApplicationConfig struct.
LanguageCodeLanguageCode, see set.h.

◆ errorApplicationSetNumber()

static void errorApplicationSetNumber ( ErrorApplicationConfig c,
u32  errorNumber 
)
inlinestatic

Sets the error code number.

Parameters
cErrorApplicationConfig struct.
errorNumberError code number. Raw decimal error number which is displayed in the dialog.

◆ errorApplicationShow()

Result errorApplicationShow ( ErrorApplicationConfig c)

Launches the applet with the specified config.

Parameters
cErrorApplicationConfig struct.

◆ errorCodeCreate()

static ErrorCode errorCodeCreate ( u32  low,
u32  desc 
)
inlinestatic

Creates an ErrorCode.

Parameters
lowThe module portion of the error, normally this should be set to module + 2000.
descThe error description.

◆ errorCodeCreateResult()

static ErrorCode errorCodeCreateResult ( Result  res)
inlinestatic

Creates an ErrorCode with the input Result.

Wrapper for errorCodeCreate.

Parameters
resInput Result.

◆ errorCodeIsValid()

static bool errorCodeIsValid ( ErrorCode  errorCode)
inlinestatic

Checks whether the input ErrorCode is valid.

Parameters
errorCodeErrorCode

◆ errorCodeRecordShow()

Result errorCodeRecordShow ( ErrorCode  errorCode,
u64  timestamp 
)

Launches the applet for displaying an error full-screen, using the specified ErrorCode and timestamp.

Parameters
errorCodeErrorCode
timestampPOSIX timestamp.
Note
Sets the following fields: jumpFlag=1, errorCode, timestamp, and uses ErrorType_Record.
The applet does not log an error report for this. error*RecordShow is used by qlaunch for displaying previously logged error reports.

◆ errorCodeShow()

Result errorCodeShow ( ErrorCode  errorCode,
bool  jumpFlag,
const ErrorContext ctx 
)

Launches the applet for displaying the specified ErrorCode.

Parameters
errorCodeErrorCode
jumpFlagJump flag, normally this is true.
ctxOptional ErrorContext, can be NULL. Unused when jumpFlag=false. Ignored on pre-4.0.0, since it's only available for [4.0.0+].
Note
Sets the following fields: jumpFlag and contextFlag2. resultFlag=1. Uses ErrorType_Normal.
Warning
This applet creates an error report that is logged in the system. Proceed at your own risk!

◆ errorEulaShow()

Result errorEulaShow ( SetRegion  RegionCode)

Launches the applet for displaying the EULA.

Parameters
RegionCodeSetRegion
Note
Sets the following fields: jumpFlag=1, regionCode, and uses ErrorType_Eula.

◆ errorResultBacktraceCreate()

Result errorResultBacktraceCreate ( ErrorResultBacktrace backtrace,
s32  count,
const Result entries 
)

Creates an ErrorResultBacktrace struct.

Parameters
backtraceErrorResultBacktrace struct.
countTotal number of entries.
entriesInput array of Result.

◆ errorResultBacktraceShow()

Result errorResultBacktraceShow ( Result  res,
const ErrorResultBacktrace backtrace 
)

Launches the applet for ErrorResultBacktrace.

Parameters
backtraceErrorResultBacktrace struct.
resResult
Note
Sets the following fields: jumpFlag=1, contextFlag=1, and uses ErrorType_Normal.
Warning
This applet creates an error report that is logged in the system. Proceed at your own risk!

◆ errorResultRecordShow()

static Result errorResultRecordShow ( Result  res,
u64  timestamp 
)
inlinestatic

Launches the applet for displaying an error full-screen, using the specified Result and timestamp.

Parameters
resResult
timestampPOSIX timestamp.
Note
Wrapper for errorCodeRecordShow, see errorCodeRecordShow notes.

◆ errorResultShow()

Result errorResultShow ( Result  res,
bool  jumpFlag,
const ErrorContext ctx 
)

Launches the applet for displaying the specified Result.

Parameters
resResult
jumpFlagJump flag, normally this is true.
ctxOptional ErrorContext, can be NULL. Unused when jumpFlag=false. Ignored on pre-4.0.0, since it's only available for [4.0.0+].
Note
Sets the following fields: jumpFlag and contextFlag2. Uses ErrorType_Normal normally.
For module=PCTL errors with desc 100-119 this sets uses ErrorType_Pctl, in which case the applet will display the following special dialog: "This software is restricted by Parental Controls".
If the input Result is 0xC8A2, the applet will display a special dialog regarding the current application requiring a software update, with buttons "Later" and "Restart".
[3.0.0+] If the input Result is 0xCAA2, the applet will display a special dialog related to DLC version.
Warning
This applet creates an error report that is logged in the system, when not handling the above special dialogs. Proceed at your own risk!

◆ errorSystemCreate()

Result errorSystemCreate ( ErrorSystemConfig c,
const char *  dialog_message,
const char *  fullscreen_message 
)

Creates an ErrorSystemConfig struct.

Parameters
cErrorSystemConfig struct.
dialog_messageUTF-8 dialog message.
fullscreen_messageUTF-8 fullscreen message, displayed when the user clicks on "Details". Optional, can be NULL (which disables displaying Details).
Note
Sets the following fields: {strings}, and uses ErrorType_System. The rest are cleared.
On pre-5.0.0 this will initialize languageCode by using: setInitialize(), setMakeLanguageCode(SetLanguage_ENUS, ...), and setExit(). This is needed since an empty languageCode wasn't supported until [5.0.0+] (which would also use SetLanguage_ENUS).
Warning
This applet creates an error report that is logged in the system. Proceed at your own risk!

◆ errorSystemSetCode()

static void errorSystemSetCode ( ErrorSystemConfig c,
ErrorCode  errorCode 
)
inlinestatic

Sets the error code.

Parameters
cErrorSystemConfig struct.
errorCodeErrorCode

◆ errorSystemSetContext()

void errorSystemSetContext ( ErrorSystemConfig c,
const ErrorContext ctx 
)

Sets the ErrorContext.

Note
Only available on [4.0.0+], on older versions this will return without setting the context.
Parameters
cErrorSystemConfig struct.
ctxErrorContext, NULL to clear it.

◆ errorSystemSetLanguageCode()

static void errorSystemSetLanguageCode ( ErrorSystemConfig c,
u64  LanguageCode 
)
inlinestatic

Sets the LanguageCode.

Parameters
cErrorSystemConfig struct.
LanguageCodeLanguageCode, see set.h.

◆ errorSystemSetResult()

static void errorSystemSetResult ( ErrorSystemConfig c,
Result  res 
)
inlinestatic

Sets the error code, using the input Result.

Wrapper for errorSystemSetCode.

Parameters
cErrorSystemConfig struct.
resThe Result to set.

◆ errorSystemShow()

Result errorSystemShow ( ErrorSystemConfig c)

Launches the applet with the specified config.

Parameters
cErrorSystemConfig struct.

◆ errorSystemUpdateEulaShow()

Result errorSystemUpdateEulaShow ( SetRegion  RegionCode,
const ErrorEulaData eula 
)

Launches the applet for displaying the system-update EULA.

Parameters
RegionCodeSetRegion
eulaEULA data. Address must be 0x1000-byte aligned.
Note
Sets the following fields: jumpFlag=1, regionCode, and uses ErrorType_SystemUpdateEula.