Custom Login errorCode

Post here your questions about the Java client / Android API for SFS2X

Moderators: Lapo, Bax

grhwood
Posts: 116
Joined: 15 Mar 2011, 04:43

Custom Login errorCode

Postby grhwood » 30 Jun 2012, 07:16

Hi,

I want to add some custom errorCodes return by server but the SFSErrorCodes class has a static errorsByCode array so the java client will throw ArrayIndexOutOfBoundsException.

Thanks
User avatar
rjgtav
Posts: 2813
Joined: 19 Apr 2009, 11:31
Location: Lisbon, Portugal

Re: Custom Login errorCode

Postby rjgtav » 30 Jun 2012, 12:34

Hi,
Well, currently you can't add more error codes. But as a workaround, you can send a custom errorMessage such as "50-This is an error", where the number is the error code and the text after the "-" is the errorMessage.
Skills: SFS Pro, SFS2X, AS2.0/AS3.0, Java, HTML5/CSS3/JS, C#
Portfolio: https://rjgtav.wordpress.com/
SFS Tutorials: http://sfs-tutor.blogspot.com/ - Discontinued. Some examples may be bugged.
User avatar
Lapo
Site Admin
Posts: 20217
Joined: 21 Mar 2005, 09:50
Location: Italy

Re: Custom Login errorCode

Postby Lapo » 30 Jun 2012, 15:26

Actually there is no need to add new error codes in that Class you can create your own custom error Class and codes with just one caveat, that you don't reuse the error codes that already exist. At the moment the error codes from 0 to 42 are already taken and I would advise to create your custom codes starting from 200. This way there is no collision with the current ones and if in future updates we'll add new codes there will be no problems as well.

Here's a quick guide on how to do it: viewtopic.php?f=18&t=14390
Let me know if there's any problem

cheers
Lapo
--
gotoAndPlay()
...addicted to flash games
Smartfoxer
Posts: 9
Joined: 18 Jul 2015, 14:32

Re: Custom Login errorCode

Postby Smartfoxer » 31 Jul 2015, 12:57

rjgtav wrote:Hi,
Well, currently you can't add more error codes. But as a workaround, you can send a custom errorMessage such as "50-This is an error", where the number is the error code and the text after the "-" is the errorMessage.


Hello,

actually that is what I am looking for.

But I see no way of how to retrive this information on the client side from the sent SFSErrorData object.

Any information would be much appreciated!

Thanks

James


EDIT: Never mind, my buddy found what we where looking for. Retrieve the sent information using errorMessage or errorCode. :D

Source: http://docs2x.smartfoxserver.com/api-do ... 432b93.htm

Return to “SFS2X Java / Android API”

Who is online

Users browsing this forum: No registered users and 2 guests