--- /dev/null
+"""
+Errors that can occur when solving a linear game.
+"""
+
+class GameUnsolvableException(Exception):
+ """
+ Every linear game has a solution (this follows from a general
+ min-max theorem). If we can't solve the conic program associated
+ with a linear game, then something is wrong with either the model of
+ the input.
+ """
+ def __init__(self, solution_dict):
+ """
+ Create a new GameUnsolvableException object.
+
+ INPUT:
+
+ - ``primal`` -- the objective value of the primal cone program.
+
+ - ``dual`` -- the objective value of the dual cone program.
+
+ - ``solution_dict`` -- the solution dictionary returned from the cone program.
+
+ """
+ tpl = 'solution failed with error: {:s}\n' \
+ 'CVXOPT returned:\n{!s}'
+ self.message = tpl.format(solution_dict['status'], solution_dict)
+
+
+class GameValueMismatchException(Exception):
+ """
+ This error occurs when the primal and dual objective value of the
+ conic program associated with a linear game do not agree. By
+ construction, every conic program derived from a linear game must
+ have a solution and the same objective value (the "value of the
+ game") is shared by both players.
+
+ Each instance of this class will know the two mismatched values, and
+ its ``message`` field will explain why they can't be so.
+ """
+ def __init__(self, primal, dual, solution_dict):
+ """
+ Create a new GameValueMismatchException.
+
+ INPUT:
+
+ - ``primal`` -- the objective value of the primal cone program.
+
+ - ``dual`` -- the objective value of the dual cone program.
+
+ - ``solution_dict`` -- the solution dictionary returned from the cone program.
+
+ """
+ tpl = 'game value mismatch for player1={:.7f}, player2={:.7f}\n' \
+ 'CVXOPT returned:\n{!s}'
+ self.message = tpl.format(primal, dual, solution_dict)