How to catch a App42Exception not related to a API App42CallBack

0 votes


if i tried to create a new user with email set to "" and App42Log.SetDebug(true). Unity catch a exception "App42Exception: EmailAddress can not be blank".

This one occured before the App42CallBack define by the userService.CreateUser service is called...

How could I catch this exception ?


asked Apr 16, 2017 in Unity by starcmd (29 points)

1 Answer

0 votes
Hi Starc,


You can put check even before calling the API, if Email address is not correct throw the error else call the API directly. Let me know if you find any issue while calling it. I will be happy to help you.



Himanshu Sharma
answered Apr 17, 2017 by hs00105 (2,005 points)
Solved !

        try {
            userService.CreateUser(user, pwd, email,roleList,MyCallBack);   
        catch (Exception e) {
            print("App42API ERROR ...");

Forgive me, I don't understand your answer...
Let say I don't want to test myself the email field.

Here is the simple code from the API doc, with the empty mail :

String userName = "Nick";  
String pwd = "********";  
String emailId = "";  
UserService userService = App42API.BuildUserService();  
userService.CreateUser(userName, pwd, emailId, new UnityCallBack());   

Until the userService.CreateUser is called there is no way for App42API to know the email is empty, right ? Then I understand the API through an error before even sending the request to the server.

How can I catch this error within Unity ?
Sorry if it's more a Unity related question ...

Hope you understand my question.
Download Widgets
Welcome to ShepHertz Product line forum, where you can ask questions and receive answers from the community. You can also reach out to us on