overriding exception message

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



I wanted to create an exception handler for certain processing I do - but
although I can 'throw' to the constructor with a parameter, I cannot
override the exception message property, the error says its read only. How
can or if a person can create the override ?

class privateException: Exception
{
public privateException(string str)
{
Console.WriteLine("User Defined Exception" +
this.Message+this.StackTrace);
// this.Message=" Special Error " + str
// you cannot seem to create modify the message.
// this input could cause some additional interaction - maybe here
// would be where a file could be written
}
public privateException()
{

}
}
--
Andrew
.



Relevant Pages

  • Re: Oh boy, how did we miss this...
    ... > frame also stores a pointer to the Object, ... I wouldn't say it uses exception frames "to create objects"; ... ClassCreate gets called by the outermost constructor in an object ... ClassCreate's exception handler can pass it to the destructor. ...
    (comp.lang.pascal.delphi.misc)
  • Re: giving parameters to forms
    ... but since the original constructor (which does not contain ... It means you can override the existing constructor to raise an exception, ... I don't like "reintroduce" all that much, but this is what it was made ...
    (alt.comp.lang.borland-delphi)
  • Re: exceptions
    ... Io was based on experience from lots of other languages. ... One typical example mentioned in AOP is precisely exception handling. ... > certainly in python ... just too bad that the end user cannot override internal C/assembler ...
    (comp.lang.python)
  • Re: overriding exception message
    ... > override the exception message property, the error says its read only. ... > class privateException: Exception ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: no throws statement in Thread.run()
    ... > public void run throws MyException(){ ... You cannot override a method to throw an exception that is not declared to ... To be more specific the new method must declare that it throws a checked ...
    (comp.lang.java.programmer)