mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
builtin: add a proper str() method to IError (#9379)
This commit is contained in:
@@ -16,6 +16,14 @@ pub:
|
||||
code int
|
||||
}
|
||||
|
||||
pub fn (err IError) str() string {
|
||||
return match err {
|
||||
None__ { 'none' }
|
||||
Error { err.msg }
|
||||
else { '$err.type_name(): $err.msg' }
|
||||
}
|
||||
}
|
||||
|
||||
const none__ = IError(&None__{})
|
||||
|
||||
struct None__ {
|
||||
|
||||
Reference in New Issue
Block a user