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.
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.
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.
NWC24OpenLib error handling: For example, when an application automatically checks for new messages at startup, this operation does not fall under "explicit use" with respect to the user, so it is not necessary to display an error message on screen. Even if an error is returned, you may consider the error to indicate that no messages were received, and continue processing. On the other hand, if it is clear to the user that a certain game sequence checks for data received by WiiConnect24, it is necessary to display an error message and notify the user that the feature or mode is not available.
NWC24OpenLib is called, as well.
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.
NWC24CommitMsg returns a file-related error, but it is not required.
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.)
NWC24CommitMsg should be handled in the same manner as when creating a message to send.
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.
NWC24Check (NWC24_USE_MESSAGES) before reading the friend roster, because accessing the console friend roster is normally followed by the transmission of a message.
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.
NWC24Check, you must first execute NWC24OpenLib. As a result, error handling in NWC24OpenLib will also be inevitably added.
Both the NWC24OpenLib and NWC24Check (NWC24_USE_DOWNLOADS) error handling sequences are necessary when adding a new download task.
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.
NWC24Check (NWC24_USE_DOWNLOADS) to check if the environment in which a download task is run is ready. Next, call NWC24GetDlError for the download task that is being used to check if a problem occurred when obtaining data from the server. To make absolutely certain that the data is the latest, we recommend including information for verifying the version inside the data.
NWC24ExecDownloadTask when that data could not be obtained, and perform data acquisition then. In this case, an error message is not displayed until an error results when executing NWC24ExecDownloadTask.
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.
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.
NWC24OpenLibNWC24Check
NWC24GetErrorCodeNWC24CommitMsg
NWC24GetDlErrorNWC24ExecDownloadTask
NWC24OpenLib Error Handling Sequence
NWC24Check (Message) Error Handling Sequence
NWC24Check (Download) Error Handling Sequence
2007/11/27 Made minor revisions in text.
2007/08/23 Initial version.
CONFIDENTIAL