all: update repo to use the new error handling syntax (#8950)

This commit is contained in:
spaceface 2021-02-28 21:20:21 +01:00 committed by GitHub
parent b9a381f101
commit d63b7bc35a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
135 changed files with 487 additions and 468 deletions

View file

@ -20,12 +20,12 @@ fn convert_html_rgb(in_col string) u32 {
mut col_mul := if in_col.len == 4 { 4 } else { 0 }
// this is the regex query, it uses V string interpolation to customize the regex query
// NOTE: if you want use escaped code you must use the r"" (raw) strings,
// NOTE: if you want use escaped code you must use the r"" (raw) strings,
// *** please remember that V interpoaltion doesn't work on raw strings. ***
query := '#([a-fA-F0-9]{$n_digit})([a-fA-F0-9]{$n_digit})([a-fA-F0-9]{$n_digit})'
mut re := regex.regex_opt(query) or { panic(err) }
mut re := regex.regex_opt(query) or { panic(err.msg) }
start, end := re.match_string(in_col)
println('start: $start, end: $end')
mut res := u32(0)
@ -49,7 +49,7 @@ fn convert_html_rgb_n(in_col string) u32 {
query := '#(?P<red>[a-fA-F0-9]{$n_digit})(?P<green>[a-fA-F0-9]{$n_digit})(?P<blue>[a-fA-F0-9]{$n_digit})'
mut re := regex.regex_opt(query) or { panic(err) }
mut re := regex.regex_opt(query) or { panic(err.msg) }
start, end := re.match_string(in_col)
println('start: $start, end: $end')
mut res := u32(0)