Debian Codegraph @

crypto/rsa/errors.ha

raw
1 // SPDX-License-Identifier: MPL-2.0
2 // (c) Hare authors <https://harelang.org>
3
4 use errors;
5
6 // Signature verification failed.
7 export type badsig = !void;
8
9 // A tagged union of all RSA error types.
10 export type error = !(
11 badsig |
12 errors::overflow |
13 errors::invalid
14 );
15
16 // Converts an [[error]] into a human-friendly string representation.
17 export fn strerror(err: error) str = {
18 match (err) {
19 case badsig =>
20 return "Signature verification failed";
21 case errors::overflow =>
22 return "Key or key operation exceeds given buffer size";
23 case errors::invalid =>
24 return errors::strerror(errors::invalid);
25 };
26 };