Page 1 of 1

6.12.1: Error Handling

Posted: Thu Mar 31, 2011 8:38 pm
by PyTom
This is the first in a series of posts about some of the new features that will be released in Ren'Py 6.12.1 - which I hope to make a pre-release of relatively soon. The goal of this, and the next few releases, is to make life easier for game-makers.

I'll start off with the new error handling feature. Previously, a Ren'Py exception was reported by the game crashing, and then (depending on platform) an error message coming up on the screen. While easy to implement, this behavior didn't have much to recommend it - it made fixing the bugs more painful then they need be.

Here's a screenshot of the error handling in 6.12.1:
Screenshot-The Ren'Py Tutorial Game-2.png
When an exception occurs that Ren'Py is capable of catching, this screen pops up. It displays a small, censored traceback at the top of the screen, showing the bits of Ren'Py code that were involved in the stack trace. When an editor is configured, you can click on the line numbers (in blue) to launch that file in a text editor.

At the bottom of the screen, there are a number of options. (The precise options shown vary based on when the error occurs.)

Rollback Choosing this option causes Ren'Py to rollback to the previous screen. For the end user, this is probably the best possible choice, as it puts him into a position to save the game.

Ignore It's often possible to try to determine what the next statement is early in the execution of a statement - for example, when the say statement runs, it will always go through to the next statement. When this is possible, the Ignore button will let the user skip through to the next statement. This can lead to errors - such as when the user Ignores a failing python block - but it may be better than nothing, especially if the game is no longer supported by the creator.

Reload is only available when config.developer is set. This reloads the game - similar to shift+R reload. This is probably what developers will use the most, as it supports a fix-the-bug-and-continue style of debugging.

Open Traceback opens the traceback in a text editor. This is what we have now - but since the new code shows the traceback on screen, it's only necessary to click this if you want to send the traceback to the maker.

Quit quits Ren'Py. Do not pass go - etc.

I figured I'd show this a bit early so that people can get used to it, and make suggestions. I'm considering adding a plug-in system that allows user code to add buttons to this screen - but the problem is that we're in a really weird state here, and I'm not sure how well it would work.

This also shows the new Ren'Py "House Style" that will be used for Ren'Py specific screens - exception handling, display troubleshooting options, the style inspector, and eventually things like the new launcher. These screens (and the styles they use) should be considered part of Ren'Py, that only advanced or very unlucky users would ever see - they aren't meant to be customized by the game-maker.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 12:56 am
by SleepKirby
Ooh, this could be quite handy - it'd be great to fix errors without having to restart the game fully. Looking forward to it! (I think the style looks nice too.)

To clarify, does the new error handling kick in for any case where Ren'Py 6.12.0 would open traceback.txt (as opposed to errors.txt)?

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 1:02 am
by PyTom
SleepKirby wrote:To clarify, does the new error handling kick in for any case where Ren'Py 6.12.0 would open traceback.txt (as opposed to errors.txt)?
That's the intent. I'm sure that the are some errors where the system will be so broken that it may fall back to the old handling, but in the majority of cases, this should work.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 3:30 am
by jack_norton
Can you also add a "Email" button?
I guess since you can display the traceback.txt on screen would be useful (during development) to allow user to click that button and using urrlib you can do mailto: to automatically compose the email with the traceback.txt as message body. Would be very useful I think.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 5:08 am
by Aleema
Can you copy/paste from this version or will it need to be opened up first?

It looks nifty, but I'll need to work with it personally before I can really say how it works. I've gotten used to the latest handling system, but then, I also hacked my editor so it wouldn't open up a new instance of my script every time I got an error, so this will hopefully kill that for those who haven't hacked their editor and hate all those new windows.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 8:34 am
by Midnighticequeen
It looks nifty, but I'll need to work with it personally before I can really say how it works. I've gotten used to the latest handling system, but then, I also hacked my editor so it wouldn't open up a new instance of my script every time I got an error, so this will hopefully kill that for those who haven't hacked their editor and hate all those new windows.
:shock: I LOVE that idea!

And as much I like the new interface, I certainly wouldn't like to see it to often, if you know what I mean. :D

Hmm...if there's one thing I would love for the error handling to display is like, a suggestion option. Like, if I'm not displaying my code right and the error message came up, I would like it if Renpy could configure a list of likely possibilities of what I'm trying to do and suggest a list with a sample of the codes that it thinks I'm trying to do.

But such a thing, might take a lot of time and effort and might be completely time consuming.
:oops: Sorry, I'll just shut up now.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 9:07 am
by papillon
Yay! (poor spiky, after I put him through all that work to build a similar system... Ours mostly works, but still occasionally falls back to old behavior, and also tends to crash thoroughly if you rollback from the error screen and then go forward to the same error)

The ability to add a custom button or two would be very much appreciated, since the one thing our version has different is the "upload traceback" button which automatically sends the tb to spiky, through a server that checks known issues and may prompt people to patch. It's been very convenient for getting people to report errors without having to take the time to make a post/mail about them. However, I can't provide any details about the behind the scenes code, I have no idea what he's doing in there. :)

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 10:32 am
by PyTom
jack_norton wrote:Can you also add a "Email" button?
I guess since you can display the traceback.txt on screen would be useful (during development) to allow user to click that button and using urrlib you can do mailto: to automatically compose the email with the traceback.txt as message body. Would be very useful I think.
I don't think urllib lets you do this.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 10:51 am
by jack_norton
Actually I tried and is enough to use this:

Code: Select all

    python hide:
        import webbrowser
        webbrowser.open_new('mailto:info@winterwolves.com')
        renpy.quit()
at least on PC works! :) not sure about Linux/Mac ?

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 12:41 pm
by PyTom
That works to send an email, but (at least for me) I can't fill in the subject or body.

Re: 6.12.1: Error Handling

Posted: Fri Apr 01, 2011 12:47 pm
by jack_norton
I found a good tutorial here: http://www.ianr.unl.edu/internet/mailto.html

I tried this and works:

Code: Select all

webbrowser.open_new('mailto:sub@winterwolves.com?subject=BUG!?&body=this is a traceback.txt')

Re: 6.12.1: Error Handling

Posted: Wed Apr 13, 2011 12:06 pm
by Friendbot2000
I absolutely love this new addition. It would make debugging do much easier! I hate having to weed through my game to test a certain piece of code.
The prospect of having error codes mailed to you is possible. I have seen it done in one of the programming classes I help teach. I don't know how to implement it because I have never had much use for it. Do you want me to save you some time by researching it Pytom?

Re: 6.12.1: Error Handling

Posted: Wed Apr 13, 2011 12:25 pm
by jack_norton
I tried "hacking" the new screen error, but apparently the webbrowser.open_new() doesn't work with mailto: inside a def func() of python. I tried opening a URL and works, so in theory you could open a webpage and pass parameters somehow... even if an email would be nicer :)