vlang/rfcs

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

igotfr opened this issue · 1 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 })