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
FlattenedTesseract
Prole
Posts: 14
Joined: Mon Jul 27, 2015 9:01 am
Location: Bucharest, Romania

Custom error handler

Post by FlattenedTesseract »

Is there any way to make a game not stop when there is an error?
What I want to do is to change the game's state inside love.errhand(), kinda like this:

Code: Select all

function love.errhand(msg)
    setState("error", {msg}) --the {msg} part sends msg to the new state
end
The error state contains an update and a draw function that are called from love.update and love.draw and should restart the game on a keypress, so the solution i'm looking for should not stop love.run.
Attachments
client.love
If you REALLY need it
(15.43 KiB) Downloaded 319 times
User avatar
Jasoco
Inner party member
Posts: 3725
Joined: Mon Jun 22, 2009 9:35 am
Location: Pennsylvania, USA
Contact:

Re: Custom error handler

Post by Jasoco »

You can try and play around with Löve's current Error Handler:

[wiki]love.errhand[/wiki]

Also look into assert() and pcall() which will let you execute code and catch errors without stopping the execution.
User avatar
FlattenedTesseract
Prole
Posts: 14
Joined: Mon Jul 27, 2015 9:01 am
Location: Bucharest, Romania

Re: Custom error handler

Post by FlattenedTesseract »

Oh, you just made me realise that I can catch and handle the errors myself, I don't have to make love do it :awesome:
Thanks!
Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 82 guests