How to serialize an exception?

During the execution of the process, exceptions occur and the exception message is very often not enough to understand the error. Is it possible to get all the information from the SE object except its message?

1 Like

Hi @Liza_Lopushanska

Try giving exception.ToString. This will print the entire error message.

Regards

1 Like

Hi
Thanks for your reply, but that’s not exactly what I was asking. I know how to get the ErrorMessage and it doesn’t work for me, I want to get the full error information with the option to log it
exception.ToString will return an error type, which doesn’t work for me either

1 Like

Hi @Liza_Lopushanska

Try this:

Exception.Message.ToString

Cheers!!

1 Like

@Liza_Lopushanska ,

I think you are looking for this. If yes use exceptionvariable.StackTrace

Thanks,
Ashok :slight_smile:

2 Likes

exception.ToString should give you the entire message, not just an error type.

But you can always access the individual properties with:

exception.Message
exception.Source
exception.StackTrace

And if there’s an InnerException:

exception.InnerException.ToString
2 Likes

Hello
Thank you for your answer. Yes, I need something like this. I was wondering if it is possible to serialize the object as such (which is not json or xml) but that should work for me as well

1 Like

Hi
Thank you very much for your reply. Yes, I think this will work for me, but I would appreciate it if there was a way to get all this information at once, such as serializing the object. So I can literally see everything inside

1 Like

@Liza_Lopushanska

Exception.stacktrace should give you almost every info you need

Cheers

1 Like

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.