Customising Exception Message

  • Thread starter Thread starter Pure Heart
  • Start date Start date
P

Pure Heart

Hi

i implemented my own Eception Class inherting from System.ApplicationException
and i use properties such as

System.Reflection.Assembly.GetCallingAssembly.GetName.Version.ToString

to add information to the displayed message, what is so important to me is
to catch
the information about the procedure name and form name that caused the
exception and instead if passing it as arggument and then chnging the value
of string in each procedure and each from isnt there a system.reflection
property that stores that information ?

thank you
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
Hi,

To know a method name you can use Method.CurrentMethod (as well as use StackFrame
to analize calling procedures), but form's name comes from Form class properties,
so it depends on what means "name", easest way is to take a type.

Regards, Alex
[TechBlog] http://devkids.blogspot.com
 
hi

do you mean this code
System.Reflection.MethodInfo.GetCurrentMethod.ToString
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643
 
Hi Pure,

Yes, exactly.

Regards, Alex
[TechBlog] http://devkids.blogspot.com

PH> hi
PH>
PH> do you mean this code
PH> System.Reflection.MethodInfo.GetCurrentMethod.ToString
PH> "Alex Meleta" wrote:
PH>
Hi,

To know a method name you can use Method.CurrentMethod (as well as
use StackFrame to analize calling procedures), but form's name comes
from Form class properties, so it depends on what means "name",
easest way is to take a type.

Regards, Alex
[TechBlog] http://devkids.blogspot.co
 
hi

when i used the line of code in last replay from me i got the text

"method name: 1.0.0.0" the method name text i added it but the value of it
1.0.0.0 comes from line of code i posted before so it dindt work properly ?
--
Ammar S. Mitoori
IT Head QIMCO Co.
Tel : +9744831199
Mobile : +9745378400
Fax : +9744831643


Alex Meleta said:
Hi Pure,

Yes, exactly.

Regards, Alex
[TechBlog] http://devkids.blogspot.com

PH> hi
PH>
PH> do you mean this code
PH> System.Reflection.MethodInfo.GetCurrentMethod.ToString
PH> "Alex Meleta" wrote:
PH>
Hi,

To know a method name you can use Method.CurrentMethod (as well as
use StackFrame to analize calling procedures), but form's name comes
from Form class properties, so it depends on what means "name",
easest way is to take a type.

Regards, Alex
[TechBlog] http://devkids.blogspot.com
 
Back
Top