Try Exception doesn't work properly in Android

0

Hi, my name is Marcos Maresch and I started few days ago to develop mobile apps with Tokyo.

 

I'm using tradicional Try... Exception... to handle errors in my apps, but Android simply ignore it.

 

  Try

    wsServico := GetIService;

  except

    on E: Exception do

    begin

      showmessage(E.Message);

      exit;

    end;

  end;

 

 

Am I doing something wrong or there's another way to handle errors in Firemonkey?

 

 

Thanks, regards, Maresch

 

  • Accepted Answer

    Thursday, September 07 2017, 02:25 AM - #Permalink
    1

    hello ...

    i think ... there is no error in your code.... check the previous code before the try expression...

    The reply is currently minimized Show
  • Responses (4)
    • Accepted Answer

      Saturday, September 09 2017, 09:07 AM - #Permalink
      1

      Thanks Roger and Robert, I'll try removing the exit and I'll do a simple division by zero test.

       

      I'll tell here what happened.

       

      Very thanks!

       

      Regards, Maresch

      The reply is currently minimized Show
    • Accepted Answer

      Friday, September 08 2017, 07:51 AM - #Permalink
      1

      Hi Marcos,

      Are you sure that the exception is being thrown when running your test on Android? This is something (obvious) to check when chasing such an apparently strange behaviour.

      Regards, Roger

      The reply is currently minimized Show
    • Accepted Answer

      Friday, September 08 2017, 05:46 AM - #Permalink
      1

      What happens if you remove the Exit line?

       

      Note that ShowMessage works different for mobile (Android/iOS): it will not wait for user input, but just run further.

      The reply is currently minimized Show
    • Accepted Answer

      Thursday, September 07 2017, 08:55 AM - #Permalink
      0

      Thanks Alkader, but what happens is that nothing really happen! Android simply ignores the exception handling. The error occurs, but doesn't show the message.

      I ran the same code in Win32 environment and, it works!

      The reply is currently minimized Show
    Your Reply

    Please login to post a reply