-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexceptions.monkey
111 lines (87 loc) · 2.01 KB
/
exceptions.monkey
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
Strict
Public
#Rem
PNG exception types, throwable when performing operations using PNG data-streams.
#End
' Imports (Public):
Import config
' Imports (Private):
Private
Import util
Import image
Import decode
Public
' Exceptions:
Class PNGException Extends Throwable
' Constructor(s):
Method New(entity:PNGEntity)
Self.entity = entity
End
' Methods:
Method ToString:String()
Return "An error occured while processing a PNG file."
End
' Fields:
Field entity:PNGEntity
End
Class PNGInputException Extends PNGException
Public
' Constructor(s):
' The 'state' argument is not guaranteed to reference an object.
Method New(content:PNG, state:PNGDecodeState) ' state:PNGDecodeState=Null
Super.New(content)
Self.content = content
Self.state = state
End
' Methods (Abstract):
Method ToString:String() Abstract
' Properties:
Method Content:PNG() Property
Return Self.content
End
Method State:PNGDecodeState() Property
Return Self.state
End
Private
' Fields:
Field content:PNG
Field state:PNGDecodeState
End
Class PNGIdentityError Extends PNGInputException
' Constructor(s):
Method New(content:PNG, state:PNGDecodeState=Null)
Super.New(content, state)
End
' Methods:
Method ToString:String()
Return "Unable to decode the input as a PNG data-stream."
End
End
Class PNGDecodeError Extends PNGInputException
Public
' Constructor(s):
Method New(content:PNG, state:PNGDecodeState, message:String)
Super.New(content, state)
Self.message = message
End
' Methods:
Method ToString:String()
Local output:= "PNG DECODE ERROR: ~q" + message + "~q"
#If REGAL_PNG_DEBUG
#If REGAL_PNG_DEBUG_STATES
output += " { " + state.ChunkName + " [" + state.ChunkLength + "] }"
#End
#If REGAL_PNG_DEBUG_STREAMS
output += " | POSITION: " + Content._dbg_stream.Position
#End
#End
Return output
End
' Properties:
Method Message:String() Property
Return message
End
Private
' Fields:
Field message:String
End