Custom Error Handler

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
MicroMacro
Citizen
Posts: 92
Joined: Fri May 30, 2014 2:30 am
Location: Boston, MA, USA
Contact:

Custom Error Handler

Post by MicroMacro »

Hey!

I am making a visual version of Love that will work like Scratch in Love. I know, I dunno why I thought it was a good idea either. xD

I need to build an error handler that won't crash the application, but can crash what the user has made so that the user can see what went wrong. So basically something that will catch the error, show where it was (if possible), and then return to the editing program.

Doable?

Thanks. :)
https://github.com/ebernerd- where you can find all my work.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: Custom Error Handler

Post by davisdude »

love.errhand should be what you're looking for.
*Fixed link
Last edited by davisdude on Fri May 29, 2015 1:54 am, edited 1 time in total.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
s-ol
Party member
Posts: 1077
Joined: Mon Sep 15, 2014 7:41 pm
Location: Cologne, Germany
Contact:

Re: Custom Error Handler

Post by s-ol »

pcall is probably more useful if you want to resume normal operation afterwards: http://www.lua.org/pil/8.4.html

s-ol.nu /blog  -  p.s-ol.be /st8.lua  -  g.s-ol.be /gtglg /curcur

Code: Select all

print( type(love) )
if false then
  baby:hurt(me)
end
User avatar
zorg
Party member
Posts: 3444
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Custom Error Handler

Post by zorg »

I have attached a demo you might find useful (or at least a decent read), since i also experimented with custom error handlers.

I also have a newer, and probably even less buggy (not that the attached one has many...) implementation, but i want to share that via a different way, soon.
Attachments
rcu.love
Realtime code editing demo
(523.22 KiB) Downloaded 133 times
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
MicroMacro
Citizen
Posts: 92
Joined: Fri May 30, 2014 2:30 am
Location: Boston, MA, USA
Contact:

Re: Custom Error Handler

Post by MicroMacro »

zorg wrote:I have attached a demo you might find useful (or at least a decent read), since i also experimented with custom error handlers.

I also have a newer, and probably even less buggy (not that the attached one has many...) implementation, but i want to share that via a different way, soon.
Is there any way that after your error handler it could return to the screen I was using? I'm making a visual version of Love in Love (again, I still don't know why) and I want to catch the errors the users mane and then return them to the screen they were programming on.
https://github.com/ebernerd- where you can find all my work.
Post Reply

Who is online

Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 188 guests