home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP27.EXE / CHP2708.PRG < prev   
Encoding:
Text File  |  1991-06-12  |  1.3 KB  |  47 lines

  1. /*
  2.    Listing 27.8. An error handler used for dealing with missing databases.
  3.    Author: Craig Yellick
  4.    Excerpted from "Clipper 5: A Developer's Guide"
  5.    Copyright (c) 1991 M&T Books
  6.                       501 Galveston Drive
  7.                       Redwood City, CA 94063-4728
  8.                       (415) 366-3600
  9. */
  10.  
  11. function MissingDBF(errObj, origBlock)
  12. /*
  13.     Special-purpose error handler for missing databases.
  14. */
  15. #include "ERROR.CH"
  16. local result
  17.  
  18.   /*
  19.      Check to see if the error is an Open Error.
  20.      If so, report the error and BREAK back to the
  21.      local section of code.
  22.   */
  23.   if errObj:genCode == EG_OPEN
  24.     @ 0,0 say "Error: All database files were not opened."
  25.     break
  26.  
  27.   /*
  28.      Error isn't what this function is designed to handle, so
  29.      pass the error along to the original error handler.
  30.      Before passing it along we use the cargo instance variable
  31.      to tack on a reminder of where the error has been. This
  32.      might be useful in debugging. If several error handlers pass
  33.      along the error they can all tack on a message to the cargo
  34.      string.
  35.   */
  36.   else
  37.     if valtype(errObj:cargo) <> "C"
  38.       errObj:cargo := ""
  39.     endif
  40.     errObj:cargo += "(Passed along from MissingDBF)"
  41.     result := eval(origBlock, errObj)
  42.   endif
  43.  
  44. return result
  45.  
  46. // end of file CHP2708.PRG
  47.