question: Add the Question.multimedia attribute
[quizzer.git] / quizzer / error.py
1 # Copyright (C) 2013 W. Trevor King <wking@tremily.us>
2 #
3 # This file is part of quizzer.
4 #
5 # quizzer is free software: you can redistribute it and/or modify it under the
6 # terms of the GNU General Public License as published by the Free Software
7 # Foundation, either version 3 of the License, or (at your option) any later
8 # version.
9 #
10 # quizzer is distributed in the hope that it will be useful, but WITHOUT ANY
11 # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
12 # A PARTICULAR PURPOSE.  See the GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License along with
15 # quizzer.  If not, see <http://www.gnu.org/licenses/>.
16
17 class CommandError (RuntimeError):
18     def __init__(self, arguments, stdin=None, stdout=None, stderr=None,
19                  status=None, msg=None):
20         error_msg = 'error executing {}'.format(arguments)
21         if msg:
22             error_msg = '{}: {}'.format(error_msg, msg)
23         super(CommandError, self).__init__(error_msg)
24         self.arguments = arguments
25         self.stdin = stdin
26         self.stdout = stdout
27         self.stderr = stderr
28         self.status = status