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}'
|
||||
}
|
||||
|
||||
fn try_open(path string) ? {
|
||||
return IError(PathError{
|
||||
fn try_open(path string) ! {
|
||||
// V automatically casts this to IError
|
||||
return PathError{
|
||||
path: path
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
|
Loading…
Reference in New Issue
Block a user