Watch, Follow, &
Connect with Us

For forums, blogs and more please visit our
Developer Tools Community.


Welcome, Guest
Guest Settings
Help

Thread: CBXE8 - How to disable Exception prompt in Android mobile ?


This question is answered. Helpful answers available: 2. Correct answers available: 1.


Permlink Replies: 2 - Last Post: May 6, 2015 8:36 PM Last Post By: GAI CHEW KAI
GAI CHEW KAI

Posts: 117
Registered: 7/25/14
CBXE8 - How to disable Exception prompt in Android mobile ?  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 6, 2015 1:31 AM
I am using Embarcadero® C++Builder XE8 Version 22.0.19027.8951, Indy 10.

Whenever TIdUDPClient->ReadBuffer() or SendBuffer() is called with UDP server is not running, the exception prompt "Socket Error # 111. Connection Refused." is displayed.

QUESTIONS:

1. I have implemented try-catch upon ReadBuffer(), although it can captured and thrown the exception but the exception prompt (dialog box in mobile) keeps popping up. How to disable or prevent the exception prompt from being displayed within the Android mobile itself ?

try
{
....ReadBuffer();
}
catch( const EIdSocketError& e )
{
if( e.LastError == 111 )
throw;
}

Please advise.
Remy Lebeau (Te...


Posts: 9,447
Registered: 12/23/01
Re: CBXE8 - How to disable Exception prompt in Android mobile ? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 6, 2015 9:51 AM   in response to: GAI CHEW KAI in response to: GAI CHEW KAI
GAI wrote:

Whenever TIdUDPClient->ReadBuffer() or SendBuffer() is called with
UDP server is not running, the exception prompt "Socket Error # 111.
Connection Refused." is displayed.

I already answered that in my reply to your other question: "CBXE8 - How
to disable Exception prompt in Android mobile ?".

1. I have implemented try-catch upon ReadBuffer(), although it can
captured and thrown the exception but the exception prompt (dialog
box in mobile) keeps popping up.

As it should be, because you are re-throwing the exception, so it will be
caught by another exception handler higher up the call stack, which in this
case is inside the RTL itself.

How to disable or prevent the exception prompt from being displayed
within the Android mobile itself ?

Stop re-throwing exceptions that you do not want the user to see, eg:

try
{
    ....ReadBuffer();
}
catch( const EIdSocketError& e )
{
    // ignore error 111, let everything else pass through
    if( e.LastError != 111 ) // use '!=' instead of '=='
        throw;
}


--
Remy Lebeau (TeamB)
GAI CHEW KAI

Posts: 117
Registered: 7/25/14
Re: CBXE8 - How to disable Exception prompt in Android mobile ? [Edit]  
Click to report abuse...   Click to reply to this thread Reply
  Posted: May 6, 2015 8:36 PM   in response to: Remy Lebeau (Te... in response to: Remy Lebeau (Te...
> Stop re-throwing exceptions that you do not want the user to see, eg:
- Yes, is working now.

Thanks again Remy.
Legend
Helpful Answer (5 pts)
Correct Answer (10 pts)

Server Response from: ETNAJIVE02