Newlines in exception messages

delphi package - automated exception handling
Post Reply
nandod
Posts: 5
Joined: Tue Sep 13, 2005 9:21 am

Newlines in exception messages

Post by nandod »

Hello,
sorry if this has been talked about before, but I couldn't find it in the forum archives and the FAQ. I am testing madExcept 3.0 with the "simple dialog with Details button", and I am wondering why the exception message has the newline characters missing and how can I have them back if possible.

Thanks
--
Nando
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

What do you mean exactly with "newline characters missing"?
nandod
Posts: 5
Joined: Tue Sep 13, 2005 9:21 am

Post by nandod »

What do you mean exactly with "newline characters missing"?
Let's say my exception text is:

This is an exception
message that spans
three lines

What I see in madExcept's dialog is this:

This is an exceptionmessage that spansthree lines

Ciao
--
Nando
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

I'll check that.
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

madExcept intentionally removes all control chars from the exception message. I'm not sure right now why I implemented that. I guess I ran across some exception messages with bad chars in it, maybe with bad line breaks in it.

I could change madExcept, so that it doesn't remove line breaks, but I'm not sure whether it's really a good idea.

You could use "%lf%" in your exception message. madExcept doesn't remove that and shows it as a line break. Does that help? Or do you still prefer, if madExcept wouldn't remove the line breaks in the first place?
nandod
Posts: 5
Joined: Tue Sep 13, 2005 9:21 am

Post by nandod »

madExcept intentionally removes all control chars from the exception message. I'm not sure right now why I implemented that. I guess I ran across some exception messages with bad chars in it, maybe with bad line breaks in it.
I'm not sure what a "bad" line break is so I cannot comment. If there are characters that cause problems to some of your processing then you could filter them and just leave line breaks in. I don't think any other control character is needed, but line breaks are different. They are used by many libraries to format exception messages.
I could change madExcept, so that it doesn't remove line breaks, but I'm not sure whether it's really a good idea.
I'm sure it's not a good idea to remove them, at least from my POV. :-)
You could use "%lf%" in your exception message. madExcept doesn't remove that and shows it as a line break. Does that help? Or do you still prefer, if madExcept wouldn't remove the line breaks in the first place?
I don't have problems with my exception messages only, but with those thrown by libraries such as IBObjects as well. I guess I could install some global handler that transforms all newlines to %lf% (would madExcept allow that, BTW?), but I'd certainly prefer an option to turn this filtering off; I believe it could be useful for many users, not just me.
Thanks.
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

I didn't know that there are 3rd party components which use multi lined exception messages. Ok, the next build of madExcept will no longer remove line breaks from exception messages.
nandod
Posts: 5
Joined: Tue Sep 13, 2005 9:21 am

Post by nandod »

Thanks!
madshi
Site Admin
Posts: 10338
Joined: Sun Mar 21, 2004 5:25 pm

Post by madshi »

If you want to try the next beta build which already will include this change, you can download it here tomorrow:

http://madshi.net/madCollectionBeta.exe
nandod
Posts: 5
Joined: Tue Sep 13, 2005 9:21 am

Post by nandod »

Works beautifully, thanks; under test now - looking forward for an official release.
Post Reply