From Ape Wiki

Jump to: navigation, search

[edit] Errors codes

List of errors code:

Error code Error value Error description
001 BAD_PARAMS A needed parameter is missing.
002 BAD_CMD Unknown command has been sent.
003 NO_CMD Did not gave a cmd. Maybe you forgot to pass your command in an array [{"cmd":"...
004 BAD_SESSID Unknown sessid has been sent.
005 BAD_JSON The JSON is not well formatted.
006 BAD_NICK In nickname.js. Nick names can not be more than 16 characters and has to be only alpha numeric.
007 NICK_USED  ?
200 UNKNOWN_CONNECTION_ERROR Unknown connection error occurred.
225-249 Reserved --
250 BAD_CHL Bad challenge number sent.
300-325 Reserved --


Please add your own if you are creating a public module.

[edit] Intercepting Errors

Errors can be intercepted on the client side using the onError() function.


onError() works as follows:

client.onError('ERROR_CODE', FUNC);

Where:

  • client is the APE.Client() object,
  • ERROR_CODE is the error code (See table above), and
  • FUNC is the callback function triggered when the error occurs.


Example: The user is alerted to a "Bad session id" (004) error.

client = new APE.Client();
 
/* Other code here. */
 
client.onError('004', function () {
    alert('You have a bad session ID. ');
});


See the official APE JSF > Core > onError documentation for details.