home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a016 / 1.ddi / CLP / BLERRC50.PRG next >
Encoding:
Text File  |  1992-03-15  |  4.7 KB  |  143 lines

  1. /****************************************************************
  2. *
  3. *  Program  : BLERRC50.PRG
  4. *           : Blinker/Clipper 5.0 Error Handler
  5. *  Date     : 92.03.14
  6. *
  7. *  Compiler : Clipper 5.0
  8. *  Linker   : Blinker 1.50
  9. *  Compile  : /n/m/w/l
  10. *
  11. *  Note     : Overlaying of this file is NOT recommended, because
  12. *           : if a severe error occurs, it may be impossible to
  13. *           : load this error handler into memory, in which case
  14. *           : the error will never be reported, making debugging
  15. *           : difficult.
  16. */
  17.  
  18. #command ? <list,...>   =>  ?? Chr(13) + Chr(10) ; ?? <list>
  19. #command ?? <list,...>  =>  OutErr(<list>)
  20.  
  21. function BlErrc50()
  22. local bBliError, bOldErrBlk, nErrCode, oErr, lUseErrBlk
  23. public lInErr       
  24.  
  25. // First check we're not in a multiple error situation
  26. // (likely cause of multiple error is an error loading
  27. // an overlay while in an error situation)
  28.  
  29. if m->lInErr
  30.    ?  "Blinker error :   "
  31.    ?? BliErrNum()
  32.    ?  "(Multiple errors occurred while in error handler)"
  33.    quit
  34. endif
  35.  
  36. m->lInErr := .T.                                // In an error
  37. lUseErrBlk = .t.                                // Use BLINKER error block
  38.  
  39. oErr := ErrorNew()                              // Create error object
  40.  
  41. nErrCode       := BliErrNum()                   // Blinker Error Number
  42. oErr:subsystem := [BLINKER]                     // Failing Subsystem name
  43. oErr:subCode   := nErrCode                      // Blinker error number
  44. oErr:canRetry  := .F.                           // Not Retryable
  45.  
  46. do case
  47.    case nErrCode = 1201
  48.         oErr:description := [unable to find overlay file ]+BliErrPrm()+[ in current path]
  49.         oErr:filename    := BliErrPrm()
  50.    case nErrCode = 1202
  51.         oErr:description := [DOS read error in file ]+BliErrPrm()
  52.         oErr:filename    := BliErrPrm()
  53.    case nErrCode = 1203
  54.         oErr:description := [file ]+BliErrPrm()+[ is not a valid .EXE file]
  55.         oErr:filename    := BliErrPrm()
  56.    case nErrCode = 1204
  57.         oErr:description := [overlay file ] + BliErrPrm() + [ does not match the .EXE file]
  58.         oErr:filename    := BliErrPrm()
  59.    case nErrCode = 1205
  60.         oErr:description := [not enough memory to load procedure]
  61.    case nERRCode = 1206
  62.         oErr:description := [maximum procedure nesting depth exceeded]
  63.         lUseErrBlk = .f.
  64.    case nERRCode = 1207
  65.         oErr:description := [demonstration calls limit exceeded]
  66.         lUseErrBlk = .f.
  67.    case nERRCode = 1208
  68.         oErr:description := [demonstration date limit exceeded]
  69.         lUseErrBlk = .f.
  70.    case nERRCode = 1209
  71.         oErr:description := [demonstration time limit exceeded]
  72.         lUseErrBlk = .f.
  73.    case nERRCode = 1210
  74.         oErr:description := [overlay has been prematurely freed]
  75.    case nERRCode = 1211
  76.         oErr:description := [overlay manager internal stack overflow]
  77.    case nERRCode = 1212
  78.         oErr:description := [Overlay Opsize exceeded - increase Opsize]
  79.    case nERRCode = 1213
  80.         oErr:description := [attempt to call DEFINED routine]
  81.         lUseErrBlk = .f.
  82.    case nERRCode = 1214
  83.         oErr:description := [error accessing EMS overlay cache]
  84.    case nERRCode = 1215
  85.         oErr:description := [error accessing XMS overlay cache]
  86.    case nERRCode = 1216
  87.         oErr:description := [overlay manager unable to resume]
  88.    case nERRCode = 1217
  89.         oErr:description := [overlay vector corrupted during execution]
  90.    otherwise
  91.         oErr:description := [unknown BLINKER error]
  92. end case
  93.  
  94. set color to
  95. cls
  96.  
  97. if lUseErrBlk
  98.    bOldErrBlk := ErrorBlock({|e|BliError(e)})   // Install new error handler
  99. else
  100.    ?? "Blinker error" + str (oErr:subCode,5)
  101.    ?? " :", oErr:description                    // Just in case error handler
  102.    ?                                            // fails
  103. endif
  104.  
  105. eval(Errorblock(),oErr)                         // Evaluate the error block
  106.  
  107. if lUseErrBlk
  108.    Errorblock(bOldErrBlk)                       // Restore the previous handler
  109. endif
  110.  
  111. m->lInErr := .F.
  112.  
  113. return (nil)
  114.  
  115. // Blinker error handler
  116.  
  117. Static Function BliError(e)
  118. local i
  119.  
  120.    ? "Error         : "
  121.  
  122.     if ( !Empty(e:subsystem()) )
  123.       ?? e:subsystem() + "/" + Ltrim(Str(e:subCode()))
  124.     end
  125.     if ( !Empty(e:description()) )
  126.       ? "Description   : " + e:description()
  127.     end
  128.    if ( !Empty(e:filename()) )
  129.       ? "Filename      : " + e:filename()
  130.     end
  131.    ?
  132.    ? "Call Trace"
  133.    i := 3
  134.     while ( !Empty(ProcName(i)) )
  135.       ? "Called from   : ", Left(ProcName(i)+SPACE(20),20) + ;
  136.          "(" + Substr(SPACE(7)+Str(ProcLine(i)),-7) + ")  "
  137.         i++
  138.     end
  139.    ?
  140.    ERRORLEVEL(1)                             
  141.    QUIT                                         // terminate application
  142. return (nil)
  143.