File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,9 @@ pub enum Kind {
36
36
Ok ,
37
37
EmptyPointerProvided ,
38
38
InvalidSeedLength ,
39
+ /// Return this when buffer for allocating error message is too small.
40
+ /// When this is the last error, the caller should try to increase the buffer size and call the function again.
41
+ BufferTooSmall ,
39
42
InternalError ,
40
43
}
41
44
@@ -133,6 +136,14 @@ impl FFIResult {
133
136
self . kind == Kind :: EmptyPointerProvided
134
137
}
135
138
139
+ pub ( super ) fn buffer_too_small ( ) -> Self {
140
+ FFIResult { kind : Kind :: BufferTooSmall , id : next_err_id ( ) }
141
+ }
142
+
143
+ pub fn is_buffer_too_small ( & self ) -> bool {
144
+ self . kind == Kind :: BufferTooSmall
145
+ }
146
+
136
147
pub ( super ) fn invalid_seed_length ( ) -> Self {
137
148
FFIResult { kind : Kind :: InvalidSeedLength , id : next_err_id ( ) }
138
149
}
@@ -157,6 +168,7 @@ impl FFIResult {
157
168
Kind :: EmptyPointerProvided => Some ( "a required pointer argument was null" ) ,
158
169
Kind :: InvalidSeedLength => Some ( "provided seed buffer has invalid length" ) ,
159
170
Kind :: InternalError => Some ( "An internal error occured" ) ,
171
+ Kind :: BufferTooSmall => Some ( "buffer was too small" ) ,
160
172
}
161
173
}
162
174
You can’t perform that action at this time.
0 commit comments