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

pull/10530/head
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
1 changed files with 4 additions and 2 deletions

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)
}
}