Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 7th Feb 2003 07:07
I don't know about some of you programmers, but alot of programmers would like to capture their errors and handle them themselves. Is there ever going to be a error capture inside the interpreter? I know you can't do anything about runtime "DBP---->Windows". It would be the unknown bug finder that would help us.

On Error Jmp _Get_error_cause
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Feb 2003 10:37
you have the CLI which handles all of the possible errors i believe.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 7th Feb 2003 10:45
Raven, he means something like in other Basic languages. Let's say you have a function like:

Function sum(a,b)
c=a+b
EndFunction c

and you enter a string as value a, lets say you pass "xyz" as a. This would cause a runtime error. So it would be nice to add something like:

Function sum(a,b)
On Error Goto ErrorLabel
c=a+b
ExitFunction c
ErrorLabel:
Print "Error blabla"
Resume Next (or End or something else)
EndFunction c

After creating an EXE file this sort of error couldn't be tracked at the moment.

Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Feb 2003 10:49
oh ... well i use the Kernel32.dll
you can use the MessageBox() command in that, so basically plug'n'play

it'll work the same way as what he want wouldn't it?

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 7th Feb 2003 12:06
No it wouldn't ... what he want's is something called "trappable errors". That's when an error occours you can deceide what to do and not the Prog.language ...

MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 7th Feb 2003 12:39
The problem is an ON ERROR command could slow things down. I personally would prefer commands to return a value depening on whether they succeeded or not.

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Hubdule
22
Years of Service
User Offline
Joined: 3rd Sep 2002
Location: Gundelsheim
Posted: 7th Feb 2003 14:39
That's true ... but the idea is not that bad because in DBPro's current version if an error occurs it simple shows a msgbox with info then get out of the program. With the ON ERROR stuff you could create a function that simply gives a certain value back ... depending on the error and without ending the program.

empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 7th Feb 2003 14:45
Yes Hubdule is right. Sort of an error trapping is already implemented in DBpro. So a global On Error command wouldn't slow down the prog.

Ogres have layers.
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 7th Feb 2003 15:22
@Toady

Yes true - but it should be up to the programmer whether or not they want to use error handling on a specific section of code. DBPro does it anyway. For example, if a model can't me loaded it internally does error checking - an On Error command would just mean that the program carried on executing instead of reporting an error message and stopping.

NOBODY has a forum name as stupid as Darth Shader. I do.
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 7th Feb 2003 15:48
Yes, it should certainly be a choice and either an ON ERROR/return value should be put in at some point...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Feb 2003 16:34
i mean i made a function for the MFC i'm working on which works like this

function Error( pError as string, dwAction as dword )
local bOK as boolean
while bOK = FALSE
bOK = MessageBox( dwScreenHeight/2, dwScreenWidth/2, pError, "Error", dwAction )
endwhile
endfunction

the message box took standard action based on what you choose as the dwAction - for example MB_OK = 1 which puts up an ok button only which just waits until its pressed and puts a number back.
however thats really for a generic error - and for more complex errors you setup a select -> case version of this specifically for that function, so the more complex functions have thier own error functions.

i suppose if i decided to use a memory pointer i could setup the case selection from how the function is called, but i mean really you could just call this one function for each error you could progress ... as the while actually sticks the loop until the return is 1 then this was cool.

i mean the whole thing took around 5mins of coding, and you could achieve the same sorta thing with the messagebox function in kernel32

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 7th Feb 2003 17:01
Erm, we're talking about error trapping. Not messageboxes.

Ogres have layers.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 7th Feb 2003 18:56
oki so what would you do once you have an error?
setup the program in a continuous loop from the error?
popup a message to tell you that you've got this error ...
look as i said that error thing simply lets the user know somethings bugger'd up, and the setup of the messagebox's allow for some diversity.

However its the fact of the example, if you want to setup certain actions IF and error happens then just setup the same kinda thing except with a case-select, i mean c'mon use some braincells here... it isn't rocket science

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 7th Feb 2003 19:09
sigh.

Error trapping, RV, error trapping!
Look at Hubdule's example. Error trapping can solve things that. It could even be used for run-time errors. Let's say you wrote a world editor. EG, If the user tries to load a corrupt 3D file DBpro will give an error message and quit the program. With error trapping:

On Error Gosub ErrorSub
Load Object Filename$,ObjNo
...
...
ErrorSub
Print "An Error occured"
Return

Error trapping, you see? Whether you popup a message box or colour the background blue in case of an error is completely irrelevant. We are talking about error trapping!

Ogres have layers.
TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 7th Feb 2003 19:14
There is nothing more unprofessional than to have a program crash out and end over a tiny error. With the error trap we could setup code to decide if the error is fatal or not and ask the customer what they would like to do like send us a error report with where the error came from, and our variable contents, or if the error is not fatal they could just log it and continue the program.

I don't think you really understand the meaning or error traping Raven, but I may be mistaken.

TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 7th Feb 2003 19:18
There is no way to capture runtime errors at present with dbp which windows captures those and jumps to its error handling routine. I have replaced that routine before but is not good practice to meddle with peoples runtime libraries. I do it to my own software on my computers only.

Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Feb 2003 04:19
see i thought thats what you ment the runtimes not the dbpro code ...
because seriously i don't see the difference between what i have for declaring the errors and what you have.

i mean think about it you're not doing anything different other than using a function for it... i mean how would you detect the error even occured?
Right now you don't need an "error trapper" as you put it for the builtin functions because DarkBasic Pro, quits and gives you the Error in basic and technical forms which can be sent over the net - i'm not sure if its to mircosoft of DBS thou

i mean look at it, if an object doesn't load its actually because DBpro is incompatible NOT because the function is incompatible ... and you can make sure you declare the error to file or popup within your own code for everything else.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 8th Feb 2003 04:29
What I meant in the post before yours Raven is that I don't think its possible to trap the runtime error in dbpro, but would like to capture errors in dbp interpreter, cause I am building a 3d editor and .bsp for DB right now, and I don't want someone to lose 10hrs of work cause they type an invalid filename or some other stupid error that db may conjure up. Sorry for the misunderstanding.

empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 8th Feb 2003 04:40
Quote: "
i mean think about it you're not doing anything different other than using a function for it... i mean how would you detect the error even occured?
"

Do you sometimes read the threads before you post? How would I detect the error occured? That is what ERROR TRAPPING is for. On Error Gosub/Goto!


Quote: "
Right now you don't need an "error trapper" as you put it for the builtin functions because DarkBasic Pro, quits and gives you the Error in basic and technical forms which can be sent over the net - i'm not sure if its to mircosoft of DBS thou

i mean look at it, if an object doesn't load its actually because DBpro is incompatible NOT because the function is incompatible ... and you can make sure you declare the error to file or popup within your own code for everything else.
"

Now it's quite obvious that you haven't read this thread. Or haven't understood what it's about.

Ogres have layers.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Feb 2003 04:51
no i see what you mean ... i think right now the only way to capture certain errors is to use the CLI, but not really viable - i suppose if you wanted to you could process the function through a DLL and if it recovers an error then you don't process that function.

i mean really to make sure you have complete control is to make sure you don't use the builtin functions as much, sticking away from things like BSP loader and Object loaders ... and make your own the the memblocks

lengthy but really the only way around it, unless as i noticed you first use the function within a DLL to check to see if it'll work.

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 8th Feb 2003 13:31
Another option would be if the commands that could generate an error (like object loading, etc) just returned a value. 1 on success, 0 on failure. So you could do:

check = load object "bob.x",1
if check=0 then uh oh

Or just use them normally otherwise.

I don't like the idea of an "on error gosub" because we don't want to encourage people to use gosubs. If should be able to call say a function instead and pass the value of the error into it. on error call perhaps which then called a function you create passing in a parameter.

I don't believe for a second that everyone should start writing their own BSP loader routines rather than use the built-in functions, that just seems lidicrous - people bought the package so they could use the builtin functions! Checking for the existance of a file before loading it isn't exactly hard, trapping the error after it's loaded is another issue though and one Lee would do well to allow control over.

Cheers,

Rich

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 8th Feb 2003 14:16
Basically, what I was originally suggesting - getting the functions to return an error value...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
empty
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: 3 boats down from the candy
Posted: 8th Feb 2003 14:18
Quote: "
I don't like the idea of an "on error gosub" because we don't want to encourage people to use gosubs. If should be able to call say a function instead and pass the value of the error into it. on error call perhaps which then called a function you create passing in a parameter.
"

Yes, that's even a better idea.
I just used "On Error Gosub" as an example, cause other (older) basic dialects implemented error trapping that way.

Ogres have layers.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Feb 2003 16:18
i think you've kinda miss'd what Pro does ... if you load up say an MD3

you have load object "test.md3",1
through no fault of the loading when the camera spots it, the entire program wil crash with an error - and i think thats what he's after her, the ability to check to see if the function has actually crashed DBpro prior to loading, or another such error.

If i'm wrong on that then i'm lost to why i was jumped all over for my response

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
Rob K
Retired Moderator
22
Years of Service
User Offline
Joined: 10th Sep 2002
Location: Surrey, United Kingdom
Posted: 8th Feb 2003 17:29
People can use whatever notation they want. Rich I thought you banned this guy ^^

NOBODY has a forum name as stupid as Darth Shader. I do.
TRS80Model1
22
Years of Service
User Offline
Joined: 2nd Feb 2003
Location: - Please Select -
Posted: 8th Feb 2003 18:55
I'm making a 3d editor and .bsp compiler in dark basic Rich, not a loading routine, hehe. Its weird not being able to edit our posts here. I wouldn't rewrite something that dbp already does.

Richard Davey
Retired Moderator
23
Years of Service
User Offline
Joined: 30th Apr 2002
Location: On the Jupiter Probe
Posted: 8th Feb 2003 19:25
I did (several times) but he's back again, new account, etc. His posts under this account so far haven't warranted any further action, but be sure I'm reading them all carefully.

Cheers,

Rich

"Gentlemen, we are about to short-circuit the Universe!"
DB Team / Atari ST / DarkForge / Retro Gaming
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 8th Feb 2003 23:32
i'm lost... how come his recent posts have been aim'd at me??

i think the notions i use are pretty sound, atleast to me they are ... my code, my legend - when you code you can use whatever legend you choose

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 9th Feb 2003 00:07
Just unlucky, I suppose...

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 9th Feb 2003 01:36
o_O No clue... O_O I'm never targeted.. its what I get for being quiet... ^_^

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
IanM
Retired Moderator
22
Years of Service
User Offline
Joined: 11th Sep 2002
Location: In my moon base
Posted: 9th Feb 2003 12:30
Well, if you're feeling left out ...

DP, you smell of hamster food, and you dress funny

Hmmm, maybe I'd better practice at being more of an ass. I'm obviously not up to saurons quality of 'ass-dom'.
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 9th Feb 2003 12:46
gonna have to side with Ian here... you do dress funny Puffy
never know that Safeway look might be fashionable someday

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?
MrTAToad
22
Years of Service
User Offline
Joined: 26th Aug 2002
Location: United Kingdom
Posted: 9th Feb 2003 16:52
Now, thats nasty!

Good news everyone! I really am THAT good...
http://www.nickk.nildram.co.uk/ for great plug-ins - oh my, yes!
Puffy
22
Years of Service
User Offline
Joined: 4th Sep 2002
Location: United States
Posted: 10th Feb 2003 10:12
=P I do not dress funny...

AMD Athlon XP 2100+ OC to 3Ghz/1.5gigs ram/128mb ti4200/120gigs hd/19" monitor/Sound Blaster Audigy Platinum EX/3072kbs Sat Con... I joined in!
Shadow Robert
22
Years of Service
User Offline
Joined: 22nd Sep 2002
Location: Hertfordshire, England
Posted: 10th Feb 2003 12:12
i know i just thought i'd take a shot cause of your new job - hehee

Tsu'va Oni Ni Jyuuko Fiori Sei Tau!
One block follows the suit ... the whole suit of blocks is the path ... what have you found?

Login to post a reply

Server time is: 2025-05-18 13:29:32
Your offset time is: 2025-05-18 13:29:32