1
0
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:
spaceface
2021-03-20 00:55:16 +01:00
committed by GitHub
parent 59f95170b3
commit 3f9e921c95
3 changed files with 11 additions and 8 deletions

View File

@@ -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__ {