mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
doc: simplify custom error example
This commit is contained in:
parent
65abfa8219
commit
eb6dd82d72
@ -3826,10 +3826,11 @@ fn (err PathError) msg() string {
|
|||||||
return 'Failed to open path: ${err.path}'
|
return 'Failed to open path: ${err.path}'
|
||||||
}
|
}
|
||||||
|
|
||||||
fn try_open(path string) ? {
|
fn try_open(path string) ! {
|
||||||
return IError(PathError{
|
// V automatically casts this to IError
|
||||||
|
return PathError{
|
||||||
path: path
|
path: path
|
||||||
})
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main() {
|
fn main() {
|
||||||
|
Loading…
Reference in New Issue
Block a user