DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 2 of 2
  1. #1
    Jim Munn Guest

    Same error #, different descriptions?


    Related to my other question about error vs retern values, is it accepted,
    encouraged, whatever to have different descriptions in an error with the
    same error number? For example, let's say I have a business component with
    an add method that validates several parameters before adding the new item.
    If multiple parameters are invalid (i.e. password too short and last name
    missing), should I raise an error for failed validataion, and in the description
    list which fields were invalid, or is this not an accepted approach? The
    other option I can think of is to raise a seperate error for each invalid
    field, but then I can only catch one invalid parameter per method call.


    P.S. I and my boss both ordered your book yesterday.

  2. #2
    Tim Patrick Guest

    Re: Same error #, different descriptions?

    It is fine to do the type of error code "sharing" that you propose. You are
    really defining a single error, a field parameter error. Since you have
    room in the Err object's properties for full disclosure of the exact error,
    there will be more than enough opportunity for you to describe the details
    of the error. Microsoft itself does this type of error code sharing in Visual
    Basic. (Sometimes I think they share too many error codes, especially when
    it comes to file access related errors, but that is another discussion.)

    Thank you for your interest in The Visual Basic Style Guide.
    Tim Patrick

Similar Threads

  1. Replies: 4
    Last Post: 07-11-2002, 08:59 AM
  2. Column descriptions in SQL
    By Lisa in forum VB Classic
    Replies: 2
    Last Post: 01-09-2002, 06:54 AM
  3. Accsess to SQL: Field Descriptions
    By ADH in forum Database
    Replies: 0
    Last Post: 06-28-2001, 01:16 AM
  4. SQL Server 2000 Field Descriptions
    By Joseph Hicks in forum Database
    Replies: 2
    Last Post: 04-17-2001, 12:55 PM
  5. Passing Select Box Descriptions Vice Values
    By Paul Hickey in forum Web
    Replies: 1
    Last Post: 04-16-2001, 02:08 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
Latest Articles
Questions? Contact us.
Web Development
Latest Tips
Open Source

   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center