Exception Type

  • Thread starter Thread starter csharpula csharp
  • Start date Start date
C

csharpula csharp

Hello ,
I am defining a new attribute for validation purposes ,in case the
validation of the object which has specific attribute not passing well
which kind of exception should I throw? (kind of Ilegal state,is there
an already defined format for it?)
Thank you!
 
Hello ,
I am defining a new attribute for validation purposes ,in case the
validation of the object which has specific attribute not passing well
which kind of exception should I throw? (kind of Ilegal state,is there
an already defined format for it?)
Thank you!

*** Sent via Developersdexhttp://www.developersdex.com***

Depends, you can create your own exception if you want. Take a look at
the exceptions deriving from either Exception or ApplicationException
to see if there is one that fits your case
 
Thanks but the question is if there is any kind of already defined
exception I should use in this case.
 
csharpula said:
I am defining a new attribute for validation purposes ,in case the
validation of the object which has specific attribute not passing well
which kind of exception should I throw? (kind of Ilegal state,is there
an already defined format for it?)

I'd look at ArgumentException. Though I'm not entirely clear from your
post whether it actually is an argument you're testing; if it's not you
might be better off creating your own derived Exception.
 
Thanks but the question is if there is any kind of already defined
exception I should use in this case.

*** Sent via Developersdexhttp://www.developersdex.com***

Hum,

Frankly I do not know. it would be nice to have a program that given a
type you get all the derived types and/or what types implement it.

Does anybody knows such a tool?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top