home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a012 / 1.ddi / CHAP27.EXE / CHP2706.PRG < prev    next >
Encoding:
Text File  |  1991-04-30  |  1.0 KB  |  45 lines

  1. /*
  2.    Listing 27.6. Source code for Clipper's ErrorMessage()
  3.                  function, located in ERRORSYS.PRG, reprinted
  4.                  here for reference.
  5.    Copyright (c) 1990-91 Nantucket Corporation
  6. */
  7.  
  8. #include "error.ch"
  9.  
  10. static func ErrorMessage(e)
  11. local cMessage
  12.  
  13.   // start error message
  14.   cMessage := if( e:severity > ES_WARNING, "Error ", "Warning " )
  15.  
  16.   // add subsystem name if available
  17.   if ( ValType(e:subsystem) == "C" )
  18.     cMessage += e:subsystem()
  19.   else
  20.     cMessage += "???"
  21.   endif
  22.  
  23.   // add subsystem's error code if available
  24.   if ( ValType(e:subCode) == "N" )
  25.     cMessage += ("/" + NTRIM(e:subCode))
  26.   else
  27.     cMessage += "/???"
  28.   endif
  29.  
  30.   // add error description if available
  31.   if ( ValType(e:description) == "C" )
  32.     cMessage += ("  " + e:description)
  33.   endif
  34.  
  35.   // add either filename or operation
  36.   if ( !Empty(e:filename) )
  37.     cMessage += (": " + e:filename)
  38.   elseif ( !Empty(e:operation) )
  39.     cMessage += (": " + e:operation)
  40.   endif
  41.  
  42. return (cMessage)
  43.  
  44. // end of file CHP2706.PRG
  45.