1 | import semver |
2 | |
3 | fn main() { |
4 | semver.from('asd') or { check_error(err) } |
5 | semver.from('') or { check_error(err) } |
6 | } |
7 | |
8 | fn check_error(err IError) { |
9 | match err { |
10 | semver.InvalidVersionFormatError { |
11 | println('wrong format') |
12 | } |
13 | semver.EmptyInputError { |
14 | println('empty input') |
15 | } |
16 | else { |
17 | println('unknown error') |
18 | } |
19 | } |
20 | } |