mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
compiler: implement error_with_code(s string, code int)
Make available the integer code as errcode to callers/unwrappers
This commit is contained in:

committed by
Alexander Medvednikov

parent
9c5a359de3
commit
8364130a1f
@ -1,3 +1,15 @@
|
||||
|
||||
fn opt_err_with_code() ?string {return error_with_code('hi',137)}
|
||||
fn test_err_with_code(){
|
||||
v := opt_err_with_code() or {
|
||||
assert err == 'hi'
|
||||
assert errcode == 137
|
||||
return
|
||||
}
|
||||
assert false
|
||||
println(v) // suppress not used error
|
||||
}
|
||||
|
||||
fn opt_err() ?string {return error('hi')}
|
||||
|
||||
fn test_err(){
|
||||
|
Reference in New Issue
Block a user