Results 1 to 23 of 23

Thread: Best error handling option for a library that doesn't throw exceptions?

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Dec 2014
    Location
    VB6 dinosaur land
    Posts
    1,190

    Best error handling option for a library that doesn't throw exceptions?

    On program startup I need to configure a bunch of DIO yet the functions needed to do so return custom error objects rather than exceptions so I'm wondering if the best way to handle this is to 1) Throw my own exception after each failed call (as shown below) or 2) the old fashioned Goto ErrorHandler in place of the Throw and do a Throw from there or 3) something else I'm not familiar with yet.


    vb.net Code:
    1. ULStat = DIO24.DConfigPort(PortNum, Direction)
    2.         If Not ULStat.Value = MccDaq.ErrorInfo.ErrorCode.NoErrors Then
    3.             errmsg = "Error in ConfigureIO during DIO24.DConfigPort: " & ULStat.Message
    4.             Throw New ArgumentException(errmsg)
    5.         End If

    Once all this is done I don't care about any other errors from this library elsewhere since they should never occur. It's stuff like "Board not configured", "invalid port number", etc that I need to catch at startup and close the program.
    Last edited by topshot; Jan 20th, 2015 at 08:54 PM.

Tags for this Thread

Posting Permissions

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



Click Here to Expand Forum to Full Width