1. crash message in 4.0

If a user sets up a crash message and the system finds an error.
When the error is reported the error message points to crash message
routine in error.e and not to the actual error.

new topic     » topic index » view message » categorize

2. Re: crash message in 4.0

bernie said...

If a user sets up a crash message and the system finds an error.
When the error is reported the error message points to crash message
routine in error.e and not to the actual error.

Yes, that was the whole point of crash_message: to provide a more user friendly (or obfuscated) message to the end user.

Matt

new topic     » goto parent     » topic index » view message » categorize

3. Re: crash message in 4.0

I am not sure what you are doing with crash message, but let's say you are removing and old ?1/0 type error to cause a crash...

if param = bad then 
   puts(1, "bad parameter") 
   ? 0/1 
end if 

You can now use crash() for that purpose and you will get your custom crash message and a full error report:

if param = bad then 
    crash("parameter was bad") 
end if 

This causes a full crash log with your error message, stack output, etc...

crash_message is designed for deployed applications to do something like:

Your program crashed. You should contact Bernie at 555-1212 for assistance 
or email to bernie@helpme.com. Please be sure to includ ex.err as an email 
attachment. 

Jeremy

new topic     » goto parent     » topic index » view message » categorize

4. Re: crash message in 4.0

jeremy said...

I am not sure what you are doing with crash message, but let's say you are removing and old ?1/0 type error to cause a crash...

if param = bad then 
   puts(1, "bad parameter") 
   ? 0/1 
end if 

You can now use crash() for that purpose and you will get your custom crash message and a full error report:

if param = bad then 
    crash("parameter was bad") 
end if 

This causes a full crash log with your error message, stack output, etc...

crash_message is designed for deployed applications to do something like:

Your program crashed. You should contact Bernie at 555-1212 for assistance 
or email to bernie@helpme.com. Please be sure to includ ex.err as an email 
attachment. 

Jeremy

-- This is the section of code executing crash message 
 
    op = opcodes[1] - OPERAND 
 
    if op < 1 or op > length(table) then 
      crash("unknown instruction") 
    end if 



This is what is reported on my Monitor



D:\#eu40\INCLUDE\STD\error.e:51 in procedure crash()
unknown instruction

... called from C:\wmotor\include\motor.e:1165 in function asm()

... called from C:\wmotor\include\motor.e:1517 in function get_asm()

... called from C:\wmotor\include\motor.e:1895 in procedure Asm()

... called from C:\wmotor\include\motor.e:2724 in function strtok()

... called from C:\wmotor\include\motor.e:3506 in function struc_()

... called from C:\wmotor\include\motor.e:3650 in function struc()

... called from C:\wmotor\include\mtrwin.ew:48


> See ex.err


Press Enter...

new topic     » goto parent     » topic index » view message » categorize

5. Re: crash message in 4.0

bernie said...

This is the section of code executing crash message

op = opcodes[1] - OPERAND

if op < 1 or op > length(table) then crash("unknown instruction") end if </eucode>

Yes. Were you expecting something else? Maybe you can do something like:

crash(sprintf("unknown instruction: %d", { op })) 

Also, when you are formatting blocks of non-code on the wiki, you can use three left french brackets on it's own line, then your block of code, then three right french brackets. If you say Reply with Quote, you can see this formatting:

This is a block of something that needs to keep 
     it's formatting exactly. 
Noticed I did not have to use any \\ or any other formatting. 

Jeremy

new topic     » goto parent     » topic index » view message » categorize

6. Re: crash message in 4.0

?1/0 produces a full ex.err, crash() is limited since the actual crash is in error.e, which is just confusing. although you do get the message, you don't get your program and function state.

when translated, ?1/0 is confusing, you tried to divide by zero
while crash("error happened in xyz") makes more sense on the console and ex.err but when translated, of course, you get no program internal details.

unless I'm doing it wrong.

new topic     » goto parent     » topic index » view message » categorize

7. Re: crash message in 4.0

ne1uno said...

?1/0 produces a full ex.err, crash() is limited since the actual crash is in error.e, which is just confusing. although you do get the message, you don't get your program and function state.

when translated, ?1/0 is confusing, you tried to divide by zero
while crash("error happened in xyz") makes more sense on the console and ex.err but when translated, of course, you get no program internal details.

unless I'm doing it wrong.

Yes, the first thing reported is crash, since that's where it happened. But the rest of the stack trace is there. If this is still unacceptable, you can call machine_proc directly, without the std/error.e wrapper.

Matt

new topic     » goto parent     » topic index » view message » categorize

8. Re: crash message in 4.0

mattlewis said...
ne1uno said...

?1/0 produces a full ex.err, crash() is limited ... unless I'm doing it wrong.

Yes, the first thing reported is crash, since that's where it happened. But the rest of the stack trace is there.

yea, sorry. had too simple of a test program. the trace is there.

new topic     » goto parent     » topic index » view message » categorize

9. Re: crash message in 4.0

mattlewis said...

Yes, the first thing reported is crash, since that's where it happened. But the rest of the stack trace is there. If this is still unacceptable, you can call machine_proc directly, without the std/error.e wrapper.

If we were to make crash() a true built-in, it should report the correct line for the first stack trace item, right?

Jeremy

new topic     » goto parent     » topic index » view message » categorize

10. Re: crash message in 4.0

jeremy said...
mattlewis said...

Yes, the first thing reported is crash, since that's where it happened. But the rest of the stack trace is there. If this is still unacceptable, you can call machine_proc directly, without the std/error.e wrapper.

If we were to make crash() a true built-in, it should report the correct line for the first stack trace item, right?

Jeremy

Yes, this would solve the issue quite elegantly.

new topic     » goto parent     » topic index » view message » categorize

11. Re: crash message in 4.0

jeremy said...
mattlewis said...

Yes, the first thing reported is crash, since that's where it happened. But the rest of the stack trace is there. If this is still unacceptable, you can call machine_proc directly, without the std/error.e wrapper.

If we were to make crash() a true built-in, it should report the correct line for the first stack trace item, right?

Yep.

Matt

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu