mirror of
https://github.com/vlang/v.git
synced 2023-08-10 21:13:21 +03:00
v.vmod: return errors instead of panic-ing
This commit is contained in:
parent
0d30667ab5
commit
405ed584a1
@ -52,7 +52,7 @@ pub fn from_file(vmod_path string) ?Manifest {
|
||||
if !os.exists(vmod_path) {
|
||||
return error('v.mod: v.mod file not found.')
|
||||
}
|
||||
contents := os.read_file(vmod_path) or { panic('v.mod: cannot parse v.mod') }
|
||||
contents := os.read_file(vmod_path) or { '' }
|
||||
return decode(contents)
|
||||
}
|
||||
|
||||
@ -189,7 +189,7 @@ fn (mut p Parser) parse() ?Manifest {
|
||||
tokens := p.scanner.tokens
|
||||
mut mn := Manifest{}
|
||||
if tokens[0].typ != .module_keyword {
|
||||
panic('not a valid v.mod')
|
||||
return error('vmod: v.mod files should start with Module')
|
||||
}
|
||||
mut i := 1
|
||||
for i < tokens.len {
|
||||
|
Loading…
Reference in New Issue
Block a user