Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagesmc
Path: blob/master/src/sage/dev/user_interface_error.py
8815 views
1
r"""
2
User interface errors
3
4
This module provides subclasses of ``RuntimeError`` to indicate error
5
conditions in the user interface.
6
7
AUTHORS:
8
9
- Julian Rueth: initial version
10
11
"""
12
#*****************************************************************************
13
# Copyright (C) 2013 Julian Rueth <[email protected]>
14
#
15
# Distributed under the terms of the GNU General Public License (GPL)
16
# as published by the Free Software Foundation; either version 2 of
17
# the License, or (at your option) any later version.
18
# http://www.gnu.org/licenses/
19
#*****************************************************************************
20
21
22
class OperationCancelledError(RuntimeError):
23
r"""
24
Indicates that the user cancelled an interactive action, e.g., the user was
25
asked to edit a file but left the editor with a non-zero exit code.
26
27
EXAMPLES::
28
29
sage: from sage.dev.user_interface_error import OperationCancelledError
30
sage: raise OperationCancelledError("cancelled")
31
Traceback (most recent call last):
32
...
33
OperationCancelledError: cancelled
34
"""
35
def __init__(self, reason):
36
r"""
37
Initialization.
38
39
EXAMPLES::
40
41
sage: from sage.dev.user_interface_error import OperationCancelledError
42
sage: type(OperationCancelledError("cancelled"))
43
<class 'sage.dev.user_interface_error.OperationCancelledError'>
44
"""
45
RuntimeError.__init__(self, reason)
46
47