forked from alanjds/grumpy
-
Notifications
You must be signed in to change notification settings - Fork 18
/
Copy pathexceptions.go
120 lines (116 loc) · 6.57 KB
/
exceptions.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
// Copyright 2016 Google Inc. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package grumpy
var (
// ArithmeticErrorType corresponds to the Python type 'ArithmeticError'.
ArithmeticErrorType = newSimpleType("ArithmeticError", StandardErrorType)
// AssertionErrorType corresponds to the Python type 'AssertionError'.
AssertionErrorType = newSimpleType("AssertionError", StandardErrorType)
// AttributeErrorType corresponds to the Python type 'AttributeError'.
AttributeErrorType = newSimpleType("AttributeError", StandardErrorType)
// BytesWarningType corresponds to the Python type 'BytesWarning'.
BytesWarningType = newSimpleType("BytesWarning", WarningType)
// DeprecationWarningType corresponds to the Python type 'DeprecationWarning'.
DeprecationWarningType = newSimpleType("DeprecationWarning", WarningType)
// EnvironmentErrorType corresponds to the Python type
// 'EnvironmentError'.
EnvironmentErrorType = newSimpleType("EnvironmentError", StandardErrorType)
// EOFErrorType corresponds to the Python type 'EOFError'.
EOFErrorType = newSimpleType("EOFError", StandardErrorType)
// ExceptionType corresponds to the Python type 'Exception'.
ExceptionType = newSimpleType("Exception", BaseExceptionType)
// FutureWarningType corresponds to the Python type 'FutureWarning'.
FutureWarningType = newSimpleType("FutureWarning", WarningType)
// ImportErrorType corresponds to the Python type 'ImportError'.
ImportErrorType = newSimpleType("ImportError", StandardErrorType)
// ImportWarningType corresponds to the Python type 'ImportWarning'.
ImportWarningType = newSimpleType("ImportWarning", WarningType)
// IndexErrorType corresponds to the Python type 'IndexError'.
IndexErrorType = newSimpleType("IndexError", LookupErrorType)
// IOErrorType corresponds to the Python type 'IOError'.
IOErrorType = newSimpleType("IOError", EnvironmentErrorType)
// KeyboardInterruptType corresponds to the Python type 'KeyboardInterrupt'.
KeyboardInterruptType = newSimpleType("KeyboardInterrupt", BaseExceptionType)
// KeyErrorType corresponds to the Python type 'KeyError'.
KeyErrorType = newSimpleType("KeyError", LookupErrorType)
// LookupErrorType corresponds to the Python type 'LookupError'.
LookupErrorType = newSimpleType("LookupError", StandardErrorType)
// MemoryErrorType corresponds to the Python type 'MemoryError'.
MemoryErrorType = newSimpleType("MemoryError", StandardErrorType)
// NameErrorType corresponds to the Python type 'NameError'.
NameErrorType = newSimpleType("NameError", StandardErrorType)
// NotImplementedErrorType corresponds to the Python type
// 'NotImplementedError'.
NotImplementedErrorType = newSimpleType("NotImplementedError", RuntimeErrorType)
// OSErrorType corresponds to the Python type 'OSError'.
OSErrorType = newSimpleType("OSError", EnvironmentErrorType)
// OverflowErrorType corresponds to the Python type 'OverflowError'.
OverflowErrorType = newSimpleType("OverflowError", ArithmeticErrorType)
// PendingDeprecationWarningType corresponds to the Python type 'PendingDeprecationWarning'.
PendingDeprecationWarningType = newSimpleType("PendingDeprecationWarning", WarningType)
// ReferenceErrorType corresponds to the Python type 'ReferenceError'.
ReferenceErrorType = newSimpleType("ReferenceError", StandardErrorType)
// RuntimeErrorType corresponds to the Python type 'RuntimeError'.
RuntimeErrorType = newSimpleType("RuntimeError", StandardErrorType)
// RuntimeWarningType corresponds to the Python type 'RuntimeWarning'.
RuntimeWarningType = newSimpleType("RuntimeWarning", WarningType)
// StandardErrorType corresponds to the Python type 'StandardError'.
StandardErrorType = newSimpleType("StandardError", ExceptionType)
// StopIterationType corresponds to the Python type 'StopIteration'.
StopIterationType = newSimpleType("StopIteration", ExceptionType)
// SyntaxErrorType corresponds to the Python type 'SyntaxError'.
SyntaxErrorType = newSimpleType("SyntaxError", StandardErrorType)
// SyntaxWarningType corresponds to the Python type 'SyntaxWarning'.
SyntaxWarningType = newSimpleType("SyntaxWarning", WarningType)
// SystemErrorType corresponds to the Python type 'SystemError'.
SystemErrorType = newSimpleType("SystemError", StandardErrorType)
// SystemExitType corresponds to the Python type 'SystemExit'.
SystemExitType = newSimpleType("SystemExit", BaseExceptionType)
// TypeErrorType corresponds to the Python type 'TypeError'.
TypeErrorType = newSimpleType("TypeError", StandardErrorType)
// UnboundLocalErrorType corresponds to the Python type
// 'UnboundLocalError'.
UnboundLocalErrorType = newSimpleType("UnboundLocalError", NameErrorType)
// UnicodeDecodeErrorType corresponds to the Python type 'UnicodeDecodeError'.
UnicodeDecodeErrorType = newSimpleType("UnicodeDecodeError", ValueErrorType)
// UnicodeEncodeErrorType corresponds to the Python type 'UnicodeEncodeError'.
UnicodeEncodeErrorType = newSimpleType("UnicodeEncodeError", ValueErrorType)
// UnicodeErrorType corresponds to the Python type 'UnicodeError'.
UnicodeErrorType = newSimpleType("UnicodeError", ValueErrorType)
// UnicodeWarningType corresponds to the Python type 'UnicodeWarning'.
UnicodeWarningType = newSimpleType("UnicodeWarning", WarningType)
// UserWarningType corresponds to the Python type 'UserWarning'.
UserWarningType = newSimpleType("UserWarning", WarningType)
// ValueErrorType corresponds to the Python type 'ValueError'.
ValueErrorType = newSimpleType("ValueError", StandardErrorType)
// WarningType corresponds to the Python type 'Warning'.
WarningType = newSimpleType("Warning", ExceptionType)
// ZeroDivisionErrorType corresponds to the Python type
// 'ZeroDivisionError'.
ZeroDivisionErrorType = newSimpleType("ZeroDivisionError", ArithmeticErrorType)
)
func systemExitInit(f *Frame, o *Object, args Args, kwargs KWArgs) (*Object, *BaseException) {
baseExceptionInit(f, o, args, kwargs)
code := None
if len(args) > 0 {
code = args[0]
}
if raised := SetAttr(f, o, NewStr("code"), code); raised != nil {
return nil, raised
}
return None, nil
}
func initSystemExitType(map[string]*Object) {
SystemExitType.slots.Init = &initSlot{systemExitInit}
}