Changeset 1136


Ignore:
Timestamp:
Sep 1, 2008, 9:22:31 AM (17 years ago)
Author:
John Small
Message:

Add/improve error handling.

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/ReleaseEdit.cmd

    r1126 r1136  
    1515 *
    1616*/
     17
     18signal on Error
     19signal on FAILURE name Error
     20signal on Halt
     21signal on NOTREADY name Error
     22signal on NOVALUE name Error
     23signal on SYNTAX name Error
     24/*
     25signal on novalue             /* for debugging */
     26*/
     27
    1728parse arg ver file .
    18 if ver = '' | stream(file, 'c', 'query exists') = '' then
    19    signal Usage                 /* and exit */
     29if ver = '' | file = '' then
     30   call Usage 0                 /* and exit */
     31else if stream(file, 'c', 'query exists') = '' then
     32   call Usage 2                 /* and exit */
    2033parse var ver major '.' minor '.' CSDLevel
    2134if CSDlevel = '' then
     
    6376
    6477Usage:
     78   parse arg plus
    6579        say;say;say
    66         lastline = sigl - 3
     80        lastline = sigl - (14 + plus)
    6781        do i = 1 to lastline
    6882                say sourceline(i)
     
    7084exit
    7185
     86/*=== Error() Report ERROR, FAILURE etc. and exit ===*/
     87
     88Error:
     89  say
     90  parse source . . cmd
     91  say 'CONDITION'('C') 'signaled at' cmd 'line' SIGL'.'
     92  if 'CONDITION'('D') \= '' then
     93    say 'REXX reason =' 'CONDITION'('D')'.'
     94  if 'CONDITION'('C') == 'SYNTAX' & 'SYMBOL'('RC') == 'VAR' then
     95    say 'REXX error =' RC '-' 'ERRORTEXT'(RC)'.'
     96  else if 'SYMBOL'('RC') == 'VAR' then
     97    say 'RC =' RC'.'
     98  say 'Source =' 'SOURCELINE'(SIGL)
     99
     100  if 'CONDITION'('I') \== 'CALL' | 'CONDITION'('C') == 'NOVALUE' | 'CONDITION'('C') == 'SYNTAX' then do
     101    trace '?A'
     102    say 'Exiting.'
     103    call 'SYSSLEEP' 2
     104    exit 'CONDITION'('C')
     105  end
     106
     107  return
     108
     109novalue:
     110   say 'Uninitialized variable: ' || condition('D') || ' on line: 'sigl
     111   say 'Line text: 'sourceline(sigl)
     112   cfg.errorcode = 3
     113   signal ErrorExit
     114
     115
  • trunk/ReleaseTool.cmd

    r1126 r1136  
    2323n = setlocal()
    2424
    25 signal on novalue
     25signal on Error
     26signal on FAILURE name Error
     27signal on Halt
     28signal on NOTREADY name Error
     29signal on NOVALUE name Error
     30signal on SYNTAX name Error
     31/*
     32signal on novalue             /* for debugging */
     33*/
     34
    2635
    2736globals = 'cmd prompt editor editorcmds'
     
    472481return
    473482
    474 /*
    475                           Upload Information Template for Hobbes.nmsu.edu
    476                           ===============================================
    477 
    478         Archive Filename: fm2-3-12-0.wpi
    479        Short Description: Mark Kimes FM/2 File Manager 3.12.0
    480         Long Description: The package contains a warpin package for installing FM2.
    481                           The FM2 source code is available on netlabs.
    482       Proposed directory
    483            for placement: os2/util/browser
    484 
    485                Your name: Gregg Young
    486            Email address: ygk@qwest.net
    487     Program contact name: (same)
    488    Program contact email: (same)
    489              Program URL: http://svn.netlabs.org/fm2
    490 
    491       Would you like the
    492    contact email address
    493     included in listings? yes
    494 
    495 Operating System/Version: OS/2 Warp 3.0 and up.
    496  Additional requirements:
    497 
    498                 Replaces: fm2-3-11-0.wpi
    499 */
    500 /*
    501                         do 11
    502                                 line = linein(HobbesTxtFilename)
    503                         end
    504                         name = strip(substr(line, wordpos(line, 3)))
    505                         line = linein(HobbesTxtFilename)
    506                         email = strip(substr(line, wordpos(line, 3)))
    507                         do 7
    508                                 line = linein(HobbesTxtFilename)
    509                         end
    510                         OKtoListEmail = strip(substr(line, wordpos(line, 4)))
    511                         do 5
    512                                 line = linein(HobbesTxtFilename)
    513                         end
    514                         replaced_wpi = word(line, 2)
    515 */
    516 
     483/*=== Error() Report ERROR, FAILURE etc. and exit ===*/
     484
     485Error:
     486  say
     487  parse source . . cmd
     488  say 'CONDITION'('C') 'signaled at' cmd 'line' SIGL'.'
     489  if 'CONDITION'('D') \= '' then
     490    say 'REXX reason =' 'CONDITION'('D')'.'
     491  if 'CONDITION'('C') == 'SYNTAX' & 'SYMBOL'('RC') == 'VAR' then
     492    say 'REXX error =' RC '-' 'ERRORTEXT'(RC)'.'
     493  else if 'SYMBOL'('RC') == 'VAR' then
     494    say 'RC =' RC'.'
     495  say 'Source =' 'SOURCELINE'(SIGL)
     496
     497  if 'CONDITION'('I') \== 'CALL' | 'CONDITION'('C') == 'NOVALUE' | 'CONDITION'('C') == 'SYNTAX' then do
     498    trace '?A'
     499    say 'Exiting.'
     500    call 'SYSSLEEP' 2
     501    exit 'CONDITION'('C')
     502  end
     503
     504  return
     505
     506novalue:
     507   say 'Uninitialized variable: ' || condition('D') || ' on line: 'sigl
     508   say 'Line text: 'sourceline(sigl)
     509   cfg.errorcode = 3
     510   signal ErrorExit
     511
     512
  • trunk/cfgmgr.cmd

    • Property svn:keywords set to Date Revision Author Id
    r1135 r1136  
    11/*
    2 ::      $Id: $
     2::      $Id$
    33
    44   CFGMGR.CMD - manage installation, maintenance and deinstallation
     
    3030
    3131n = setlocal()
    32 t = time('e')
    33 signal on novalue                 /* for debugging */
     32
     33signal on Error
     34signal on FAILURE name Error
     35signal on Halt
     36signal on NOTREADY name Error
     37signal on NOVALUE name Error
     38signal on SYNTAX name Error
     39/*
     40signal on novalue             /* for debugging */
     41*/
    3442
    3543call RxFuncAdd 'SysLoadFuncs', 'REXXUTIL', 'SysLoadFuncs'
     
    477485   say 'through the FM2USER group on Yahoo.'
    478486exit
    479 
    480 novalue:
    481    say 'Uninitialized variable: ' || condition('D') || ' on line: 'sigl
    482    say 'Line text: 'sourceline(sigl)
    483    cfg.errorcode = 3
    484    signal ErrorExit
    485487
    486488CfgAction: procedure expose (globals)
     
    638640return
    639641
     642/*=== Error() Report ERROR, FAILURE etc. and exit ===*/
     643
     644Error:
     645  say
     646  parse source . . cmd
     647  say 'CONDITION'('C') 'signaled at' cmd 'line' SIGL'.'
     648  if 'CONDITION'('D') \= '' then
     649    say 'REXX reason =' 'CONDITION'('D')'.'
     650  if 'CONDITION'('C') == 'SYNTAX' & 'SYMBOL'('RC') == 'VAR' then
     651    say 'REXX error =' RC '-' 'ERRORTEXT'(RC)'.'
     652  else if 'SYMBOL'('RC') == 'VAR' then
     653    say 'RC =' RC'.'
     654  say 'Source =' 'SOURCELINE'(SIGL)
     655
     656  if 'CONDITION'('I') \== 'CALL' | 'CONDITION'('C') == 'NOVALUE' | 'CONDITION'('C') == 'SYNTAX' then do
     657    trace '?A'
     658    say 'Exiting.'
     659    call 'SYSSLEEP' 2
     660    exit 'CONDITION'('C')
     661  end
     662
     663  return
     664
     665/* end Error */
     666
     667novalue:
     668   say 'Uninitialized variable: ' || condition('D') || ' on line: 'sigl
     669   say 'Line text: 'sourceline(sigl)
     670   cfg.errorcode = 3
     671   signal ErrorExit
     672
     673
Note: See TracChangeset for help on using the changeset viewer.