Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Returning Friendly System.ArgumentException messages

Status
Not open for further replies.

colin81

Technical User
Jul 22, 2002
77
GB
Hi All

Is it possible to throw a friendly error when a Function is called with the incorrect datatypes or missing values?

For example if a user invoked a web method located on a web service which only excepted a value which was of datatype date with a value of 'bob' how could I get a friendly message to be returned instead of an exception? I know I could except all arguments as string and then convert/validate them but is there an other way?

Many Thanks
Colin
 
put the calling statement in a try block:

Code:
Try
  DoFunction("Bob")
Catch e as Exception
  'put code here to display error in your own way
  'or define a new exception w/ your custom message and
  'throw it with:
  'Throw(new MyCustomException())
End Try

-Rick

----------------------
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top