Error Applet: Difference between revisions

No edit summary
Line 1: Line 1:
This is the applet presented when a title displays an error message.
This is the applet presented when a title displays an error message. See [[AM_services#Library_Applets|Library Applets]].
See [[AM_services#Library_Applets]].


All errors displayed by this applet get logged and can be viewed under 'Settings' > 'Support' > 'Error History'.
All errors displayed by this applet get logged and can be viewed under 'Settings' > 'Support' > 'Error History'.
Line 6: Line 5:
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.
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 ==
= ErrorContext =
This is "nn::err::ErrorContext". This is a 0x200-byte struct.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
Line 20: Line 21:
|}
|}


This 0x200 bytes struct is used to set specific error contexts for [[Error_Report_services#SubmitContext|erpt:c]].
This is used to set specific error contexts for [[Error_Report_services#SubmitContext|erpt:c]].


Depending on '''Type''', different error report fields will be attached and sent:
Depending on '''Type''', different error report fields will be attached and sent:
Line 29: Line 30:
* Type 4: [[Error_Report_services#Fields|LcsApplicationId]], [[Error_Report_services#Fields|LcsContentMetaKeyIdList]], [[Error_Report_services#Fields|LcsContentMetaKeyVersionList]], [[Error_Report_services#Fields|LcsContentMetaKeyTypeList]], [[Error_Report_services#Fields|LcsSenderFlag]], [[Error_Report_services#Fields|LcsApplicationRequestFlag]], [[Error_Report_services#Fields|LcsHasExFatDriverFlag]], [[Error_Report_services#Fields|LcsIpAddress]] and  [[Error_Report_services#Fields|ResultBacktrace]].
* Type 4: [[Error_Report_services#Fields|LcsApplicationId]], [[Error_Report_services#Fields|LcsContentMetaKeyIdList]], [[Error_Report_services#Fields|LcsContentMetaKeyVersionList]], [[Error_Report_services#Fields|LcsContentMetaKeyTypeList]], [[Error_Report_services#Fields|LcsSenderFlag]], [[Error_Report_services#Fields|LcsApplicationRequestFlag]], [[Error_Report_services#Fields|LcsHasExFatDriverFlag]], [[Error_Report_services#Fields|LcsIpAddress]] and  [[Error_Report_services#Fields|ResultBacktrace]].


== ErrorCommonHeader ==
= ErrorViewerStartupParamCommon =
This is "nn::err::ErrorViewerStartupParamCommon". This is a 0x4-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x1 || [[#ErrorType|ErrorType]]
|-
| 0x1 || 0x1 || IsJumpEnabled
|-
| 0x2 || 0x2 || Reserved
|}
 
= ErrorViewerStartupParamForApplicationError =
This is "nn::err::ErrorViewerStartupParamForApplicationError". This is a 0x1014-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x3 || Reserved
|-
| 0x8 || 0x4 || [[#ApplicationErrorCodeNumber|ApplicationErrorCodeNumber]]
|-
| 0xC || 0x8 || [[Settings_services#LanguageCode|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+] [[Applet_Manager_services#GetMainAppletApplicationControlProperty|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.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x3 || Reserved
|-
| 0x8 || 0x4 || [[Settings_services#RegionCode_2|RegionCode]]
|}
 
* ErrorType = 3. Displays the EULA.
 
= ErrorViewerStartupParamForParentalControl =
This is "nn::err::ErrorViewerStartupParamForParentalControl". This is a 0xC-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|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.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x1 || u8 type
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x3 || Reserved
|-
|-
| 0x1 || 0x1 || u8 jumpFlag. When clear, this indicates WithoutJump.
| 0x8 || 0x4 || [[#ApplicationErrorCodeNumber|ApplicationErrorCodeNumber]]
|-
|-
| 0x2 || 0x3 || ?
| 0xC || 0x4 || Reserved
|-
|-
| 0x5 || 0x1 || u8 contextFlag. When set with type=0, indicates that an additional storage is pushed for [[#ResultBacktrace]]. [4.0.0+]: When set indicates that an additional storage is pushed for [[#ErrorContext]].
| 0x10 || 0x8 || TimeOfOccurrence (u64 PosixTime)
|-
|-
| 0x6 || 0x1 || u8 resultFlag. [[#ErrorCommonArg]]: When clear, ErrorCode is used, otherwise the applet generates the error-code from res.
| 0x18 || 0x8 || [[NS_services#ApplicationErrorCodeCategory|ApplicationErrorCodeCategory]]
|-
|-
| 0x7 || 0x1 || u8 contextFlag2. Similar to contextFlag except for [[#ErrorCommonArg]], indicating [[#ErrorContext]] is used.
| 0x20 || 0x800 || Message (UTF-8 string)
|}
|}


== ErrorCommonArg ==
= ErrorViewerStartupParamForRecordedSystemData =
This is "nn::err::ErrorViewerStartupParamForRecordedSystemData". This is a 0x18-byte struct.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || ErrorCommonHeader
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x3 || Reserved
|-
|-
| 0x8 || 0x8 || [[#ErrorCode]]
| 0x8 || 0x8 || [[#ErrorCode|ErrorCode]]
|-
|-
| 0x10 || 0x4 || Result res
| 0x10 || 0x8 || TimeOfOccurrence (u64 PosixTime)
|}
|}


ShowError: type=0, jumpFlag={varies}, contextFlag2={set when ErrorContext used}.
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.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x3 || Reserved
|-
| 0x8 || 0x8 || [[#ErrorCode|ErrorCode]]
|-
| 0x10 || 0x8 || TimeOfOccurrence (u64 PosixTime)
|-
| 0x18 || 0x800 || Message (UTF-8 string)
|}
 
= ErrorViewerStartupParamForSystemData =
This is "nn::err::ErrorViewerStartupParamForSystemData". This is a 0x14-byte struct.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|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|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 <code>ShowUnacceptableApplicationVersionError</code>.
* 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 <code>ShowUnacceptableApplicationVersionError</code>.
* [3.0.0+] There's also special dialog handling for Result 0xCAA2. The official user-process name for this is <code>ShowUnacceptableAddOnContentVersionError</code>.
* [3.0.0+] There's also special dialog handling for Result 0xCAA2. The official user-process name for this is <code>ShowUnacceptableAddOnContentVersionError</code>.


== ErrorPctlArg ==
= ErrorViewerStartupParamForSystemError =
This is "nn::err::ErrorViewerStartupParamForSystemError". This is a 0x1018-byte struct.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || ErrorCommonHeader. type=4.
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x1 || [4.0.0+] HasErrorContext ([1.0.0-3.0.2] Reserved)
|-
| 0x6 || 0x2 || Reserved
|-
| 0x8 || 0x8 || [[#ErrorCode|ErrorCode]]
|-
| 0x10 || 0x8 || [[Settings_services#LanguageCode|LanguageCode]]
|-
| 0x18 || 0x800 || DialogMessage (UTF-8 string)
|-
|-
| 0x8 || 0x4 || Result res
| 0x818 || 0x800 || FullScreenMessage (UTF-8 string, displayed when the user clicks on "Details" and when not set this disables displaying "Details")
|}
|}


This struct is 0xC-bytes. Used instead of [[#ErrorCommonArg]] where a Result error would have been displayed with type=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".
= ErrorViewerStartupParamForSystemUpdateEula =
This is "nn::err::ErrorViewerStartupParamForSystemUpdateEula". This is a 0xC-byte struct.


== ErrorEulaData ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x20000 || data
| 0x0 || 0x4 || [[#ErrorViewerStartupParamCommon|Common]]
|-
| 0x4 || 0x1 || Version
|-
| 0x5 || 0x3 || Reserved
|-
| 0x8 || 0x4 || [[Settings_services#RegionCode_2|RegionCode]]
|}
|}


== ErrorEulaArg ==
* ErrorType = 8. Displays the system-update EULA. Uses an additional IStorage containing [[#EulaData|EulaData]], from [[Applet_Manager_services#CreateTransferMemoryStorage]] with flag=false.
 
= ErrorViewerReturnValue =
This is "nn::err::ErrorViewerReturnValue". This is a 0x2-byte struct.
 
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || ErrorCommonHeader. jumpFlag = 1.
| 0x0 || 0x1 || Version
|-
|-
| 0x8 || 0x4 || [[Settings_services|RegionCode]]
| 0x1 || 0x1 || [[#ErrorViewerJumpDestination|Destination]]
|}
|}


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


* Eula: ErrorCommonHeader.type = 3. Displays the EULA.
{| class="wikitable" border="1"
* SystemUpdateEula: ErrorCommonHeader.type = 8. Displays the system-update EULA. Uses an additional IStorage containing [[#ErrorEulaData]], from [[Applet_Manager_services#CreateTransferMemoryStorage]] with flag=false.
|-
! Offset || Size || Description
|-
| 0x0 || 0x1014 || [[#ErrorViewerStartupParamForApplicationError|StartupParam]]
|}
 
= SystemErrorArg =
This is "nn::err::SystemErrorArg". This is a 0x1028-byte struct.


== ErrorRecordArg ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x8 || ErrorCommonHeader. type=5 and jumpFlag=1.
| 0x0 || 0x1018 || [[#ErrorViewerStartupParamForSystemError|StartupParam]]
|-
|-
| 0x8 || 0x8 || [[#ErrorCode]]
| 0x1018 || 0x9 || ServerCode
|-
|-
| 0x10 || 0x8 || u64 POSIX timestamp
| 0x1021 || 0x7 || Reserved
|}
|}


The applet does not log an error report for this. Used by [[qlaunch]] for viewing previously logged errors via the "View the Error" button.
= ErrorType =
This is "nn::err::ErrorType".


== SystemErrorArg ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Value
! Description
|-
| 0 || SystemData
|-
| 1 || SystemError
|-
| 2 || ApplicationError
|-
| 3 || Eula
|-
|-
| 0x0 || 0x8 || ErrorCommonHeader. type=1.
| 4 || ParentalControl
|-
|-
| 0x8 || 0x8 || [[#ErrorCode]]
| 5 || RecordedSystemData
|-
|-
| 0x10 || 0x8 || [[Settings_services|LanguageCode]]
| 6 || RecordedSystemError
|-
|-
| 0x18 || 0x800 || UTF-8 string dialogMessage
| 7 || RecordedApplicationError
|-
|-
| 0x818 || 0x800 || UTF-8 string fullscreenMessage, displayed when the user clicks on "Details". When not set this disables displaying Details.
| 8 || SystemUpdateEula
|}
|}


This struct is 0x1018-bytes.
= ErrorViewerJumpDestination =
This is "nn::err::ErrorViewerJumpDestination".


== ApplicationErrorArg ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Value
! Description
|-
|-
| 0x0 || 0x8 || ErrorCommonHeader. type=2 and jumpFlag=1.
| 0 || Nowhere
|-
|-
| 0x8 || 0x4 || u32 errorNumber. Raw decimal error number which is displayed in the dialog.
| 1 || Set_SystemUpdate
|-
|-
| 0xC || 0x8 || [[Settings_services|LanguageCode]]
| 2 || Set_DataManagement
|-
|-
| 0x14 || 0x800 || UTF-8 string dialogMessage
| 3 || Set_InternetSetting
|-
|-
| 0x814 || 0x800 || UTF-8 string fullscreenMessage, displayed when the user clicks on "Details". When not set this disables displaying Details.
| 4 || Cabinet_NfpDataSetting
|}
|}


This struct is 0x1014-bytes.
= ErrorCode =
This is "nn::err::ErrorCode". This is an u64.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || [[#ErrorCodeCategory|Category]]
|-
| 0x4 || 0x4 || [[#ErrorCodeNumber|Number]]
|}


[10.0.0+] [[Applet_Manager_services#GetMainAppletApplicationControlProperty|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.
= 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.
 
{| class="wikitable" border="1"
|-
! Offset || Size || Description
|-
| 0x0 || 0x4 || DataCount
|-
| 0x4 || 0x3C || Reserved
|-
| 0x40 || 0x4 || [[Settings_services#Language|Language]]
|-
| 0x44 || 0x4 || Reserved
|-
| 0x48 || 0x8 || Size
|-
| 0x50 || 0x1FFB0 || Body
|}


== ErrorCode ==
= ResultBacktrace =
This is an u64 containing the [[Error_codes|error-code]]: the low u32 is the module portion which is normally set to <code>module + 2000</code>, and the high u32 is the error description.
This is "nn::err::ResultBacktrace". This is a 0x84-byte struct.


== ResultBacktrace ==
{| class="wikitable" border="1"
{| class="wikitable" border="1"
|-
|-
! Offset || Size || Description
! Offset || Size || Description
|-
|-
| 0x0 || 0x4 || s32 total entries
| 0x0 || 0x4 || Count
|-
|-
| 0x4 || 0x4*total_entries || Array of Result
| 0x4 || 0x4 * 32 || Array of Result
|}
|}


== Usage ==  
= 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.
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.


[[Category:Library Applets]]
[[Category:Library Applets]]