NWC24 Error Handling Sequence

Introduction

When creating applications that support WiiConnect24, processing must take into account the restrictions and operation status of WiiConnect24. NWC24 functions may return errors depending on these restrictions and status. When one of these errors is returned, the features that use WiiConnect24 cannot be made available. You must notify the user by displaying the error message and error code (a six-digit number) to the screen.

Please refer to WiiConnect24 Programming Guidelines for the type of notification required for a specific error. This document describes error sequence examples based on the guidelines, including possible specific use.

Functions that are Particularly Important to Error Handling

Error handling is particularly important for the following two functions in the NWC24 API.

NWC24OpenLib determines whether the NWC24 library itself can be used. For example, it will return an error in situations such as a failure occurring in a system file and usage no longer being possible.

NWC24Check determines availability of the NWC24 feature, including console settings and network connection. When it is not available, NWC24Check returns an error corresponding to that state.

Error handling for these two functions is necessary to execute most operations that use NWC24.

Examples of Error Handling for Various Processes

Reading a received message

The NWC24OpenLib error handling sequence is the only item required when an application checks for a received message in the inbox. Because this check only involves messages that are already in the inbox, verification by NWC24Check is not necessary.

Creating a message to send

When creating a message to send to another Wii console or to an e-mail address, both the NWC24OpenLib and NWC24Check (NWC24_USE_MESSAGES) error handling sequences are required.

Creating a message for the Wii Message Board

When creating a message for the local Wii Message Board, the only requirement is the NWC24OpenLib error handling sequence. Verification with NWC24Check is not necessary because this process does not involve network communication, and this feature is not restricted by the console settings related to WiiConnect24. (There is no restriction on messages to another console's Wii Message Board.)

Reading the Friend Roster (Address Book)

The action of reading the console friend roster is not itself restricted by network communications or WiiConnect24 settings. Consequently, it is acceptable to perform only the NWC24OpenLib error handling sequence.

Confirmation of agreement for automatic transmissions

As described in Creating a Message to Send, the user's consent must be obtained in advance, and then the user must turn on a feature that automatically sends that user's scores at regular intervals to a specified Friend. During the setting sequence to turn the feature ON, NWC24Check (NWC24_USE_SETTING) must be executed to avoid any conflict with the console WiiConnect24 settings. If an error is returned, the feature must be disabled.

Adding a new download task

Both the NWC24OpenLib and NWC24Check (NWC24_USE_DOWNLOADS) error handling sequences are necessary when adding a new download task.

Confirming downloaded data

It is theoretically possible for data that was obtained by a download task to be verified independently of NWC24, because verification only references a VF file. However, calling NWC24OpenLib in advance is required to access the VF file, so the error handling sequence for NWC24OpenLib is also required.



Displaying Error Messages and Error Codes

When an on-screen notification is necessary during an error handling sequence, refer to WiiConnect24 Programming Guidelines and WiiConnect24 Message List for error messages, and display an appropriate message.

The six-digit error code can be obtained by executing NWC24GetErrorCode immediately after a function has returned an error. If NWC24GetErrorCode returns 0, this means that either a notification is not necessary for that error or the error code is not defined. In the event that it is necessary to display an error message when an error code is undefined, use the general-purpose NWC24_ERRCODE_UNDEFINED (-109999) error code, which indicates a "miscellaneous error".

There is no particular restriction on the screen layout for displaying error messages and error codes, as long as it is in a format that can be read normally.



Operations After the Error Handling Sequence Runs

When an error is generated through non-explicit user actions, it is not necessary to display an error message. The application can simply continue to run, given that the desired process that used WiiConnect24 did not occur.

Although it is necessary to display an error message for an explicit user error, the application can simply continue to run as in the previous case, given that the desired process that used WiiConnect24 failed. However, should the application be unable to proceed without the desired process, it is acceptable either to run OSReturnToMenu to return to the Wii Menu or to run OSRestart to restart the application.



See Also

NWC24OpenLib
NWC24Check
NWC24GetErrorCode
NWC24CommitMsg
NWC24GetDlError
NWC24ExecDownloadTask

NWC24OpenLib Error Handling Sequence
NWC24Check (Message) Error Handling Sequence
NWC24Check (Download) Error Handling Sequence

Revision History

2007/11/27 Made minor revisions in text.
2007/08/23 Initial version.


CONFIDENTIAL