XO0202: error type does not convert to the enclosing error type
expr? on a Result[T, E2] returns the error from the enclosing function, so E2 must convert to its error type E: E2 is E, or E is Error and E2 implements Display, or E has a from E2 variant. Add a from variant, derive Display for an Error target, or convert inline with map_err. The same rule applies inside a closure whose error type is fixed. See core 2.6.
Example
enum LoadErr { Timeout }
enum ApiErr { Bad }
fn g() -> Int ! LoadErr { 1 }
fn f() -> Int ! ApiErr { g()? }Fix
enum LoadErr { Timeout }
enum ApiErr { Bad, Load(from LoadErr) }
fn g() -> Int ! LoadErr { 1 }
fn f() -> Int ! ApiErr { g()? }Run xo explain XO0202 for this text in a terminal, or see
section 10.6 of the specification.