question

osvbnet avatar image
0 Votes"
osvbnet asked osvbnet commented

Remove repeated multiple nested inner exceptions

Hey, using such code:

Try
...connect to some remote server...
Catch Exception As Exception
MsgBox(Exception.Message)
End Try

Can throw different exceptions, but in some cases, repeated multiple nested inner exceptions will throw like this:

 IOException occurred during SSL negotiation. InnerException message follows: An existing connection was forcibly closed by the remote host. InnerException message follows: An existing connection was forcibly closed by the remote host InnerException message follows: An existing connection was forcibly closed by the remote host

I have the same inner exception 3 times with the same message text! This it not very usual, but how can I filter the repeated ones? The message text can be very different so can't use string manipulation.

Any help please? :)
Thanks in advance.

dotnet-visual-basic
· 2
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @osvbnet ,
May I know if you have got any chance to check my answer? I am glad to help if you have any other questions.

0 Votes 0 ·
osvbnet avatar image osvbnet JiachenLiMFST-9349 ·

Hey thanks so much, although the message text can be very different so can't use string manipulation, but I found another way to do it :)

0 Votes 0 ·

1 Answer

JiachenLiMFST-9349 avatar image
0 Votes"
JiachenLiMFST-9349 answered

Hi @osvbnet ,
If you just want to get non-repeated error information, you can choose to split the string by '.', and then remove the repeated part from the whole.
I think the first error message should always be surrounded by '.'.
Best Regards.
Jiachen Li


If the answer is helpful, please click "Accept Answer" and upvote it.
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.