v/examples/errors.v

21 lines
328 B
V
Raw Normal View History

2021-03-29 11:17:00 +02:00
import semver
fn main() {
semver.from('asd') or { check_error(err) }
semver.from('') or { check_error(err) }
}
fn check_error(err IError) {
match err {
semver.InvalidVersionFormatError {
println('wrong format')
}
semver.EmptyInputError {
println('empty input')
}
else {
println('unknown error')
}
}
}