Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Error 48?
#11
Quote:Could a special FBERRORCODE value be added to the compiler that holds the last error generated? Then if the programmer wanted to use it for non-function statements it could just be checked at each call?

BLOAD "image.bmp"
IF FBERRORCODE <> 0 THEN
' error roporting
END IF

So you'd like to have FBERRORCODE work close to like Pascal's IRResult variable?
hen they say it can't be done, THAT's when they call me ;-).

[Image: kaffee.gif]
[Image: mystikshadows.png]

need hosting: http://www.jc-hosting.net
All about ASCII: http://www.ascii-world.com
Reply
#12
Getting back to V1C, I wasn't aware that OPEN could be used as
function in that manner. Can you expand on your example just
a little bit please --

If I want to use OPEN as a function, in order to check for its return
value to see if I got a permission denied error -- is it necessary first
to enable error handling?

-- If the answer is NO, then am I correct to assume that the FB app
would by default continue running, without breaking, when an error
is encountered? In other words, what by default is supposed to
happen if FB encounters a permission denied on opening a file if
I have not explicitly enabled error handling? I would want it
to break at that point, lest my code goes on to do other things
that will make matters worse.

-- If the answer is YES, then how should I enable error handling
if not by using an ON ERROR GOTO? I mean, it seems there must
be some other way of enabling error handling, since the example
of OPEN returning a value wouldn't make me GOTO a label. If it
did, then I'd hate to always go to the same place.

Alas, it works the old way, so for now, this old dog doesn't have
to learn to many new tricks. Thank you again!

Dean
Reply
#13
Quote:So you'd like to have FBERRORCODE work close to like Pascal's IRResult variable?

I have worked with Pascal, but I'm not familiar with IRResult. I have used IOResult to handle errors associated with file access.

Some of the other "basic like" languages in development have something similar that the programmer can double-check after a critical piece of code (video, file, sound, etc.) and handle the error appropriately...

...or not...
ature has its way of warning a person away from danger: The distinct black and white coloration on a skunk, the chilling buzz of a rattlesanke, a redneck handing you his beer and saying "Watch this!"
Reply
#14
You can do that since 0.12, if you don't compile with the -e or -ex options.

BLOAD "foo.bar"
IF ERR <> 0 THEN error...

Btw, BLOAD and BSAVE will become functions too in 0.14, the result can be checked the old way or as for an ordinary function.

If you don't compile with the -e option no runtime error checking is done, if you use -e and doesn't supply an error handler then a runtime error message will be shown when something went wrong.

Code:
if open( "filename", for input, as #1 ) <> 0 then print "open error:"; err: end 1

    do until eof( 1 )
        if get( #1, , somevar ) <> 0 then print "get error:"; err : exit do
    loop

    if close( #1 ) <> 0 then print "close error:"; err: end 1

Compile with -e, -ex or without them it will work the same way.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)