vlang / rfcs

RFCs for changes to V

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Option, Result, Error Handling] support access to other fields than msg and code from err

igotfr opened this issue · comments

struct MyError {
  msg string
  value int
  code int
}

fn f() ?int {
  return IError(MyError{msg: 'Invalid', value: 98})
}

fn main() {
  println(f() or { err.value })
}
error: type `IError` has no field named `value`
   29 | 
   30 | fn main() {
   31 |   println(f() or { err.value })