Error Applet

From Nintendo Switch Brew
Revision as of 21:02, 2 March 2023 by Hexkyz (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

This is the applet presented when a title displays an error message. See Library Applets.

All errors displayed by this applet get logged and can be viewed under 'Settings' > 'Support' > 'Error History'.

On pre-5.0.0 the specified LanguageCode has to be valid, otherwise a fatal-error is thrown. With [5.0.0+] it will use en-US when the LanguageCode is invalid.

ErrorContext

This is "nn::err::ErrorContext". This is a 0x200-byte struct.

Offset Size Description
0x0 0x1 Type
0x1 0x7 Padding
0x8 0x1F4 Data
0x1FC 0x4 Result

This is used to set specific error contexts for erpt:c.

Depending on Type, different error report fields will be attached and sent:

ErrorViewerStartupParamCommon

This is "nn::err::ErrorViewerStartupParamCommon". This is a 0x4-byte struct.

Offset Size Description
0x0 0x1 ErrorType
0x1 0x1 IsJumpEnabled
0x2 0x2 Reserved

ErrorViewerStartupParamForApplicationError

This is "nn::err::ErrorViewerStartupParamForApplicationError". This is a 0x1014-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x4 ApplicationErrorCodeNumber
0xC 0x8 LanguageCode
0x14 0x800 DialogMessage (UTF-8 string)
0x814 0x800 FullScreenMessage (UTF-8 string, displayed when the user clicks on "Details" and when not set this disables displaying "Details")

[10.0.0+] GetMainAppletApplicationControlProperty is now used internally by the applet, on failure the applet will throw a fatalerr. Hence, ApplicationError can't be used from non-Applications (such as LibraryApplet) anymore.

ErrorViewerStartupParamForEula

This is "nn::err::ErrorViewerStartupParamForEula". This is a 0xC-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x4 RegionCode
  • ErrorType = 3. Displays the EULA.

ErrorViewerStartupParamForParentalControl

This is "nn::err::ErrorViewerStartupParamForParentalControl". This is a 0xC-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x4 PctlResultRestricted

Used where a Result error would have been displayed with ErrorType=0, for module=PCTL errors with desc 100-119. For this the applet will display the following dialog (without report logging): "This software is restricted by Parental Controls".

ErrorViewerStartupParamForRecordedApplicationError

This is "nn::err::ErrorViewerStartupParamForRecordedApplicationError". This is a 0x820-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x4 ApplicationErrorCodeNumber
0xC 0x4 Reserved
0x10 0x8 TimeOfOccurrence (u64 PosixTime)
0x18 0x8 ApplicationErrorCodeCategory
0x20 0x800 Message (UTF-8 string)

ErrorViewerStartupParamForRecordedSystemData

This is "nn::err::ErrorViewerStartupParamForRecordedSystemData". This is a 0x18-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x8 ErrorCode
0x10 0x8 TimeOfOccurrence (u64 PosixTime)

The applet does not log an error report for this. Used by qlaunch for viewing previously logged errors via the "View the Error" button.

ErrorViewerStartupParamForRecordedSystemError

This is "nn::err::ErrorViewerStartupParamForRecordedSystemError". This is a 0x818-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x8 ErrorCode
0x10 0x8 TimeOfOccurrence (u64 PosixTime)
0x18 0x800 Message (UTF-8 string)

ErrorViewerStartupParamForSystemData

This is "nn::err::ErrorViewerStartupParamForSystemData". This is a 0x14-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x1 HasResultBacktrace
0x6 0x1 IsErrorCode
0x7 0x1 [4.0.0+] HasErrorContext ([1.0.0-3.0.2] Reserved)
0x8 0x8 ErrorCode
0x10 0x4 Result

ShowError: ErrorType=0, IsJumpEnabled={varies}, HasErrorContext={set when ErrorContext used}.

  • 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". The official user-process name for this is ShowUnacceptableApplicationVersionError.
  • [3.0.0+] There's also special dialog handling for Result 0xCAA2. The official user-process name for this is ShowUnacceptableAddOnContentVersionError.

ErrorViewerStartupParamForSystemError

This is "nn::err::ErrorViewerStartupParamForSystemError". This is a 0x1018-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x1 [4.0.0+] HasErrorContext ([1.0.0-3.0.2] Reserved)
0x6 0x2 Reserved
0x8 0x8 ErrorCode
0x10 0x8 LanguageCode
0x18 0x800 DialogMessage (UTF-8 string)
0x818 0x800 FullScreenMessage (UTF-8 string, displayed when the user clicks on "Details" and when not set this disables displaying "Details")

ErrorViewerStartupParamForSystemUpdateEula

This is "nn::err::ErrorViewerStartupParamForSystemUpdateEula". This is a 0xC-byte struct.

Offset Size Description
0x0 0x4 Common
0x4 0x1 Version
0x5 0x3 Reserved
0x8 0x4 RegionCode

ErrorViewerReturnValue

This is "nn::err::ErrorViewerReturnValue". This is a 0x2-byte struct.

Offset Size Description
0x0 0x1 Version
0x1 0x1 Destination

ApplicationErrorArg

This is "nn::err::ApplicationErrorArg". This is a 0x1014-byte struct.

Offset Size Description
0x0 0x1014 StartupParam

SystemErrorArg

This is "nn::err::SystemErrorArg". This is a 0x1028-byte struct.

Offset Size Description
0x0 0x1018 StartupParam
0x1018 0x9 [4.0.0+] ServerCode
0x1021 0x7 [4.0.0+] Reserved

ErrorType

This is "nn::err::ErrorType".

Value Description
0 SystemData
1 SystemError
2 ApplicationError
3 Eula
4 ParentalControl
5 RecordedSystemData
6 RecordedSystemError
7 RecordedApplicationError
8 SystemUpdateEula

ErrorViewerJumpDestination

This is "nn::err::ErrorViewerJumpDestination".

Value Description
0 Nowhere
1 Set_SystemUpdate
2 Set_DataManagement
3 Set_InternetSetting
4 Cabinet_NfpDataSetting

ErrorCode

This is "nn::err::ErrorCode". This is an u64.

Offset Size Description
0x0 0x4 Category
0x4 0x4 Number

ErrorCodeCategory

This is "nn::err::ErrorCodeCategory". This is an u32.

ErrorCodeNumber

This is "nn::err::ErrorCodeNumber". This is an u32.

ApplicationErrorCodeNumber

This is "nn::err::ApplicationErrorCodeNumber". This is an u32.

EulaData

This is "nn::err::EulaData". This is a 0x20000-byte struct.

Offset Size Description
0x0 0x4 DataCount
0x4 0x3C Reserved
0x40 0x4 Language
0x44 0x4 Reserved
0x48 0x8 Size
0x50 0x1FFB0 Body

ResultBacktrace

This is "nn::err::ResultBacktrace". This is a 0x84-byte struct.

Offset Size Description
0x0 0x4 Count
0x4 0x4 * 32 Array of Result

Usage

User-processes should push a common arguments struct (version=0) as well as the Arg struct. Once the applet finishes running successfully, it may return an output storage in some cases. An u8 status value is located at +1, where non-zero indicates error.