aboutsummaryrefslogtreecommitdiff
path: root/v_windows/v/examples/errors.v
blob: e763fcfd0c144e5c552c35e4aed146a3d3b5eeea (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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')
		}
	}
}