The Poker Copilot Blog

Tracking the development of Poker Copilot, Mac OS X software for poker analysis and statistics.

Tuesday, 27 April 2010

Pleasant Error Handling and Nasty Error Handling

Loyal Poker Copilot user Manuela was having problems getting Poker Copilot to recalculate equity values. It would work for about 11,000 hands, then act as if it was finished. Only it wasn't.

The problem was that one hand caused a problem for Poker Copilot. The code to handle an error that occurred while recalculating equity values looked something like this:

if error occurred while calculating then
Stop calculating.
Pretend everything is okay.
end if


Well, it was a lot more complicated than that, but once I worked out the cause, it could be reduced to naive error handling.

There are three ways one can handle such problems in code:

1) Try to recover as silently as possible, don't bug the user, and keep running. This seems user-friendly, but actually hides the underlying problem, which causes worse, hard-to-diagnose problems later on.

2) Give the user an error message, but continue when they click OK. "There was an AQ-787-34.2 error while processing your data. Please report this to the Poker Copilot team. Click OK to continue." This just puzzles most users. Even a human-understandable error message is puzzling and perhaps disconcerting. Most users won't report the problem. Of those who do, most will report something like, "Poker Copilot has a problem. What shall I do?" Which is useless as a bug report.

3) Crash violently, in a way that can't be ignored. Automatically generate a crash report which the user can send with one click. Because the buggy action stops the program from continuing, and the user probably wants to continue, they'll most likely click the "Send Crash Report" button. This forces the error to reveal itself as soon as possible. The crash report contains all the information needed to pinpoint the location in the code where the crash occurred. It also contains other useful info, such as the version of Poker Copilot, the Mac OS X version, the Java version, and the user's Mac OS X language settings.

Somewhat counter-intuitively, the best way to have low-error software is for the software to crash completely and immediately when it encounters an unexpected problem (an "unknown unknown"). Perhaps this wasn't so when software came on a disk you bought in a bricks-and-mortar shop, and getting updates was hard. But with always-on, high-speed Internet where software can be updated frequently, it works well.

In the next update Poker Copilot stops suddenly and creates a crash report if recalculating equity values fails.

1 comment:

Mtume said...

Steve,

Re: "In the next update Poker Copilot stops suddenly and creates a crash report if recalculating equity values fails."

You're a very funny guy. :-)

Mtume.

P.S. I know you're not joking, but the dry way you put that is very amusing.

 

Poker Copilot

Free 30 Day Trial

Only $69

Order risk free with our 30-day money back guarantee.

  • Poker tracking software for Mac OS X
  • Supports PokerStars, Winamax, Merge Network, Ongame Network
  • Analyses your opponents while you play
  • On-table HUD for Mac
  • Easy to use, easy to understand

Watch a demo of the major features of Poker Copilot