1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

v ast: eprintln and exit instead of panic on invalid file errors (#10526)

This commit is contained in:
zakuro 2021-06-20 19:12:08 +09:00 committed by GitHub
parent 44d0305ca9
commit ce3681ee8f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -74,10 +74,12 @@ fn get_abs_path(path string) string {
// check file is v file and exists
fn check_file(file string) {
if os.file_ext(file) !in ['.v', '.vv', '.vsh'] {
panic('the file `$file` must be a v file or vsh file')
eprintln('the file `$file` must be a v file or vsh file')
exit(1)
}
if !os.exists(file) {
panic('the v file `$file` does not exist')
eprintln('the v file `$file` does not exist')
exit(1)
}
}