Jump to content




Creating A Bsod, Error Handling And Custom Errors


  • You cannot reply to this topic
66 replies to this topic

#21 Dlcruz129

    What's a Lua?

  • Members
  • 1,423 posts

Posted 16 February 2013 - 04:37 PM

View PostTheOriginalBIT, on 16 February 2013 - 04:21 PM, said:

View PostDlcruz129, on 16 February 2013 - 04:15 PM, said:

I'm not gonna release mine. You're welcome. :P/>
I'm not saying don't release it, I'm saying they are just the most common.

I wasn't planning on releasing it in the first place.

#22 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 16 February 2013 - 04:42 PM

View PostDlcruz129, on 16 February 2013 - 04:37 PM, said:

I wasn't planning on releasing it in the first place.
Lol ok then :P

#23 GravityScore

  • Members
  • 796 posts
  • LocationLand of Meh

Posted 17 February 2013 - 10:58 PM

Great tutorial. I always thought BSoD were something that was very low-level in the system, and if they were in CC you could only call it a BSoD if it were in the BIOS or somewhere close to that. TIL Firewolf has a BSoD (except it's red, so a RSoD)

#24 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 17 February 2013 - 11:02 PM

View PostGravityScore, on 17 February 2013 - 10:58 PM, said:

Great tutorial. I always thought BSoD were something that was very low-level in the system, and if they were in CC you could only call it a BSoD if it were in the BIOS or somewhere close to that. TIL Firewolf has a BSoD (except it's red, so a RSoD)
Thanx :)
BSoD/Kernal Panic is normally very low-level in the system, as it caused by something low-level going wrong. However in a standard CC program this is as low-level as we can get, so thats as low as we go ;) :P

Haha, how did you not know your own program had a RSoD? :P haha RSoD, kinda just makes me think RRoD :P

#25 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 19 February 2013 - 08:32 PM

Added new section "A Custom Assert" to OP

#26 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 February 2013 - 08:08 PM

Bug fix in code for "A custom assert"

#27 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 21 February 2013 - 08:10 PM

I don't understand how the custom assert works?

#28 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 February 2013 - 08:18 PM

View Postsuperaxander, on 21 February 2013 - 08:10 PM, said:

I don't understand how the custom assert works?
It works just like the assert that is default to Lua...... if you don't understand my explanation lets see if I can find a tutorial on it...... here is one

Ok so what the custom assert does is adds a level to the error. now what a level does.

Assume we have this code:
function three()
  assert( false, "An error", <level>)
end

function two()
  three()
end

function one()
  two()
end

one()
Now if we don't specify a level the line number (and program name) will be pointing to where the error occurs, in this case line 2. If we supply a level of 2, then it will point to 2 levels down the program stack, which is the function calling our function, which would be line 6. If we give a level of 3 it will show the error being at line 10 (being the function that is 3 levels down from the top of the stack). now if we supplied a level of 5, then well that is before our function isn't it, so the error then gets pointed to the shell, if we do 6 it will be bios, anything above the very bottom level (bios) will give unexpected results.

#29 superaxander

  • Members
  • 609 posts
  • LocationHolland

Posted 21 February 2013 - 08:28 PM

Now I understand thanks

#30 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 February 2013 - 08:29 PM

View Postsuperaxander, on 21 February 2013 - 08:28 PM, said:

Now I understand thanks
No problems :)

#31 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 23 February 2013 - 06:52 AM

Hmm Bit, the split function in your test code in the OP is missing one important thing ... the letter 't' ...

Right now it just returns, but it needs to be return t :P

#32 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 23 February 2013 - 01:33 PM

View PostremiX, on 23 February 2013 - 06:52 AM, said:

Hmm Bit, the split function in your test code in the OP is missing one important thing ... the letter 't' ...

Right now it just returns, but it needs to be return t :P
Hmmm, I wonder how that got removed. It was literally a copy/paste of a functioning bsod.

#33 remiX

  • Members
  • 2,076 posts
  • LocationSouth Africa

Posted 24 February 2013 - 12:23 PM

View PostTheOriginalBIT, on 23 February 2013 - 01:33 PM, said:

View PostremiX, on 23 February 2013 - 06:52 AM, said:

Hmm Bit, the split function in your test code in the OP is missing one important thing ... the letter 't' ...

Right now it just returns, but it needs to be return t :P
Hmmm, I wonder how that got removed. It was literally a copy/paste of a functioning bsod.

Scumbag copy pasta :P

#34 momona5

  • Members
  • 14 posts

Posted 20 March 2013 - 12:19 PM

View PostNDFJay, on 15 February 2013 - 12:36 AM, said:

Got to say, this is one sexy tutorial :) Made my error handling function now :) if an error is caught it does this >>

Spoiler

EDIT--

When Click on either "Email Error to NDFJay" or "Save Error Log" this happens >>
Spoiler

:D


Do you have the code for this? I'm loving the look of it.If you do still have it could I use it?

#35 NDFJay

  • Members
  • 216 posts
  • LocationLeeds, England

Posted 21 March 2013 - 03:00 AM

View Postmomona5, on 20 March 2013 - 12:19 PM, said:

View PostNDFJay, on 15 February 2013 - 12:36 AM, said:

--snip

Do you have the code for this? I'm loving the look of it.If you do still have it could I use it?

I made it into an API which can be found HERE with all its explanations and how to use it, the API allows custom crash screens with custom text/colours and allignment as well as saving the crash log to a custom location of your choice and works with CC 1.3 and up

#36 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 21 March 2013 - 04:46 AM

meh, id rather just not make errors in my code

#37 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 March 2013 - 04:51 AM

View PostPixelToast, on 21 March 2013 - 04:46 AM, said:

meh, id rather just not make errors in my code
so you never use the assert or error functions in any of your programs?

#38 PixelToast

  • Signature Abuser
  • 2,265 posts
  • Location3232235883

Posted 21 March 2013 - 05:06 AM

some of them
but i dont know why you would want to
i would prefer a UI to do that

#39 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 21 March 2013 - 05:09 AM

A UI to do assert? O.o
Assert is one of the best tools that can be used in any language.

#40 theoriginalbit

    Semi-Professional ComputerCrafter

  • Moderators
  • 7,332 posts
  • LocationAustralia

Posted 02 April 2013 - 05:32 AM

After reading some of the code made by the CC devs, I have discovered that if you do a level of 0 on the error function it will not print the error message with the file name and line number. It is essentially
printError( 'Some Error' )
error()

this is a very handy trick to quickly exit the program, print a red message, but now show it as an error in the code. as such I have updated the assert function in the 'A Custom Assert' section to also do the same.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users