Any reason why love.errhand wouldn't work?

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
dizzykiwi3
Citizen
Posts: 58
Joined: Tue Jan 14, 2014 2:03 am

Any reason why love.errhand wouldn't work?

Post by dizzykiwi3 »

I'm currently attempting to write a custom love.errhand, however, whenever it is called, my game simply quits.

To initiate the crash I'm running

Code: Select all

a="b"+"c"
However, even when changing love.errhand to the default code found at https://love2d.org/wiki/love.errhand, it still simply closes the game, no error message. I'm able to see console print statements called from within the love.errhand, but I have no idea why this keeps happening.

Any help would be much appreciated!

p.s. running on a mac if this makes any difference.
grump
Party member
Posts: 947
Joined: Sat Jul 22, 2017 7:43 pm

Re: Any reason why love.errhand wouldn't work?

Post by grump »

What are you doing in your errhand? Where do you provoke the error? Maybe there is no window yet, and you're trying do draw stuff? Move the error to love.draw or love.update.
User avatar
dizzykiwi3
Citizen
Posts: 58
Joined: Tue Jan 14, 2014 2:03 am

Re: Any reason why love.errhand wouldn't work?

Post by dizzykiwi3 »

grump wrote: Wed Aug 30, 2017 10:52 pm What are you doing in your errhand? Where do you provoke the error? Maybe there is no window yet, and you're trying do draw stuff? Move the error to love.draw or love.update.
The error is triggered in the update by a keypress after everything has loaded and drawn for a while. The errhand is verbatim the code from the wiki, which is supposed to be the default blue screen error handler.
User avatar
dizzykiwi3
Citizen
Posts: 58
Joined: Tue Jan 14, 2014 2:03 am

Re: Any reason why love.errhand wouldn't work?

Post by dizzykiwi3 »

I tested the errhand on a simple one file load, update, draw, and it seems to work there... so something's up with my game
User avatar
dizzykiwi3
Citizen
Posts: 58
Joined: Tue Jan 14, 2014 2:03 am

Re: Any reason why love.errhand wouldn't work?

Post by dizzykiwi3 »

FOUND IT!

I have a variable named debug, which, according to this post is a no no https://love2d.org/forums/viewtopic.php ... and#p14892
User avatar
raidho36
Party member
Posts: 2063
Joined: Mon Jun 17, 2013 12:00 pm

Re: Any reason why love.errhand wouldn't work?

Post by raidho36 »

The app quits as soon as errhand returns. You need to manually loop forever while drawing error screen and polling for user input, as you would in a normal run function. You're not allowed to error from within error handler.
User avatar
bartbes
Sex machine
Posts: 4946
Joined: Fri Aug 29, 2008 10:35 am
Location: The Netherlands
Contact:

Re: Any reason why love.errhand wouldn't work?

Post by bartbes »

dizzykiwi3 wrote: Wed Aug 30, 2017 11:17 pm FOUND IT!

I have a variable named debug, which, according to this post is a no no https://love2d.org/forums/viewtopic.php ... and#p14892
Yes, love now has a local reference to the actual debug module, which is why the inbuilt error handler doesn't have this problem. If you don't, and you overwrite the debug module it will error again in the error handler, and the game will close.

Also, please don't double post.
Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot] and 20 guests