Error Checking/Trapping w/VB Components

Results 1 to 2 of 2

Thread: Error Checking/Trapping w/VB Components

  1. #1
    Andrew Ventura Guest

    Default Error Checking/Trapping w/VB Components

    After spending a good week developing a full library of components I hate how I&#039ve implemented my error checking. Most functions I&#039ve created either return TRUE or FALSE to determine whether or not the call ran succesfully. So everytime I call the COM object in ASP I gotta do something like this<BR><BR>If MYCOMobj.SomeFuction(MyPassThrus) Then<BR>&#039Call Executed Correctly<BR>SOME VBSCRIPT HERE<BR>Else<BR>&#039Call Failed<BR>Response.write(MYCOMobj.ErrorMsg)<BR>End If<BR><BR>Pain in the butt if you ask me.. I find my ASP code is becoming overun with nested IF THEN ELSEIFs.. any suggestions on a better way of doing it? <BR><BR><BR>Andy<BR><BR>

  2. #2
    Jason Miller Guest

    Default RE: Error Checking/Trapping w/VB Components

    Try having your successful functions return null and the unsuccessful functions return the error description. Then:<BR><BR> (you made the call)<BR> if not isBlank(strReturn) then sendError(strReturn)<BR> (otherwise the call was good)<BR><BR>[sendError(strIn) handles errors whatever way you like; isBlank(srtIn) tests if a string is null, empty or simply lacks characters after a trim()]<BR><BR>Hope that helps!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts