Page 1 of 1

Error Handler problem

Posted: Mon Jul 07, 2008 2:50 pm
by Seb McClouth
Hey

I'm using NOVIX error handler, which uses the following code in my QBinux.BI-file:

Code: Select all

'CODE STUFF HERE

ON ERROR GOTO OnError
Which runs the following in Handle.BI:

Code: Select all

DEFINT A-Z
'$DYNAMIC
OnError:
IF ERR <> 0 THEN
    IF ERR = 53 THEN
    FileFound = "0"

  ELSEIF ERR = 64 THEN
    FileFound = "0"
    
  ELSEIF ERR = 75 THEN
    PathAccess = "0"
    
  ELSEIF ERR = 76 THEN
    DirFound = "0"
    
  ELSE
    CLOSE
    PRINT "QBinux encounterd an unrecoverable error"
    PRINT "  Error code:"; ERR; " (h"; HEX$(ERR); " b"'; NUM2BITS(ERR, 8); ")"
    PRINT
    PRINT 'cTask
    PRINT 'ErrorMessage
    PRINT
    SYSTEM
  END IF
  PRINT "RESUME":RESUME NEXT
END IF
For some odd reason it doesn't RESUME NEXT...

It occures when I try to create a new dir in the NoViXFileSystem. The code to make a directory is a following:

Code: Select all

SUB MakDir (dir AS STRING)
odir$ = CurDir
dirn$ = WorkPath(dir)
IF dirn$ = "DNF" THEN CurDir = odir$: EXIT SUB
IF GetID(dirn$, 1) <> 0 THEN CurDir = odir$: EXIT SUB
IF INSTR(dirn$, ">") THEN CurDir = odir$: EXIT SUB
IF INSTR(dirn$, "<") THEN CurDir = odir$: EXIT SUB
IF INSTR(dirn$, "|") THEN CurDir = odir$: EXIT SUB
IF dirn$ = "FNF" THEN CurDir = odir$: EXIT SUB
IF INSTR(dirn$, CHR$(34)) THEN CurDir = odir$: EXIT SUB
DO
did$ = RHEX(8)
LOOP UNTIL FindFATFile ("NVXFS/" + did$ + ".nfd") = 0 AND VAL("&H" + did$) <> 0
ff = FREEFILE
OPEN "NVXFS/DirList.nfd" FOR BINARY AS #ff
IF LOF(ff) = 0 THEN g$ = MKI$(0): PUT #ff, 1, g$
t$ = "  "
GET #ff, 1, t$
offs& = CVI(t$) * 272& + 3&
dirdate$ = SPACE$(271)
MID$(dirdata$, 1, 256) = CHR$(LEN(dirn$)) + dirn$
MID$(dirdata$, 257, 4) = CurDrive
MID$(dirdata$, 261, 4) = CurDir
MID$(dirdata$, 265, 4) = MKL$(VAL("&H" + did$))
MID$(dirdata$, 269, 1) = PriPub
MID$(dirdata$, 270, 1) = CurUser
MID$(dirdata$, 271, 1) = IsSystem
PUT #ff, offs&, dirdata$
t$ = "  "
GET #ff, 1, t$
g$ = MKI$(CVI(t$) + 1): PUT #ff, 1, g$
CLOSE #ff
OPEN "NVXFS/" + did$ + ".nfd" FOR APPEND AS #ff
PRINT #ff, CHR$(2) + CHR$(5) + CHR$(1) + CHR$(1);
PRINT #ff, MKL$(VAL("&H" + did$));
PRINT #ff, CurDir;
PRINT #ff, CurDrive;
PRINT #ff, dirn$;
CLOSE #ff
CurDir = odir$
END SUB
Things appear to go wrong around:

Code: Select all

DO
did$ = RHEX(8)
LOOP UNTIL FindFATFile ("NVXFS/" + did$ + ".nfd") = 0 AND VAL("&H" + did$) <> 0
THE RHEX-function is okay so it isn't that and the FindFATFile works fine before that.

did$ is the name for the file to be written, and FindFATFile must find out of it exists or not.

For some odd reason the program stops running here and just quits.

Grtz

Posted: Mon Jul 07, 2008 3:28 pm
by MystikShadows
Maybe something at the NOVIX level is clearing the error before it gets a chance to get back to your level of code?

Posted: Mon Jul 07, 2008 3:35 pm
by Seb McClouth
That's what I thought a couple of months back as I had the same problem with previous versions... Z!re couldn't help me out... and I still can't locate the exact problem...

Posted: Mon Jul 07, 2008 5:58 pm
by burger2227
Try eliminating the PRINT "Resume". I think the error quits on any subsequent code before RESUME NEXT. Just a guess?

Ted

Posted: Tue Jul 08, 2008 12:30 am
by Seb McClouth
Eey Burger! Well I just wrote it there so that I knew that if actually gets there, I'd see the message. But I'll try to see what happens if I take it out.

Thx & grtz

Posted: Tue Jul 08, 2008 2:42 am
by Anonymous
are you using vista?

Posted: Tue Jul 08, 2008 6:57 am
by Seb McClouth
I'm using DosBox under XP...

Posted: Tue Jul 08, 2008 6:39 pm
by roy
This is a shot in the dark but with this section of code:-

Code: Select all

SUB MakDir (dir AS STRING) 
odir$ = CurDir 
dirn$ = WorkPath(dir) 
IF dirn$ = "DNF" THEN CurDir = odir$: EXIT SUB 
IF GetID(dirn$, 1) <> 0 THEN CurDir = odir$: EXIT SUB 
IF INSTR(dirn$, ">") THEN CurDir = odir$: EXIT SUB 
IF INSTR(dirn$, "<") THEN CurDir = odir$: EXIT SUB 
IF INSTR(dirn$, "|") THEN CurDir = odir$: EXIT SUB 
IF dirn$ = "FNF" THEN CurDir = odir$: EXIT SUB 
IF INSTR(dirn$, CHR$(34)) THEN CurDir = odir$: EXIT SUB 
odir$ = CurDir and then you make CurDir = odir$ but surely CurDir already = odir$.
As I say, it is a wild guess.

Posted: Wed Jul 09, 2008 12:45 pm
by Seb McClouth
That code is written be Z!re and proved to have no problems in NOVIX.

From what some PRINT-statements I've added, the farest it gets is to

Code: Select all

DO
did$ = RHEX(8)
LOOP UNTIL FindFATFile ("NVXFS/" + did$ + ".nfd") = 0 AND VAL("&H" + did$) <> 0 
Somehow the FindFATFile hangs here and quits.

FindFATFile works with the error handler and if a certain file error occurs and it's in the error handler, the error handler will give the proper assigment e.g. a file doesn't exist, resulting in a return to FindFATFile = 0.

Thx for helping!

grtz