builtin: make panics more IDE friendly

pull/9343/head
Delyan Angelov 2021-03-16 18:46:11 +02:00
parent e554415123
commit 1753445a64
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED
4 changed files with 4 additions and 6 deletions

View File

@ -207,7 +207,7 @@ fn main() {
args := os.args.clone()
args_string := args[1..].join(' ')
cmd_prefix := args_string.all_before('test-self')
title := 'testing all tests'
title := 'testing vlib'
all_test_files := os.walk_ext(os.join_path(vroot, 'vlib'), '_test.v')
testing.eheader(title)
mut tsession := testing.new_test_session(cmd_prefix)

View File

@ -22,8 +22,7 @@ fn panic_debug(line_no int, file string, mod string, fn_name string, s string) {
eprintln(' module: $mod')
eprintln(' function: ${fn_name}()')
eprintln(' message: $s')
eprintln(' file: $file')
eprintln(' line: ' + line_no.str())
eprintln(' file: $file:$line_no')
eprintln('=========================================')
$if exit_after_panic_message ? {
C.exit(1)

View File

@ -138,7 +138,7 @@ fn (mut v Builder) rebuild_cached_module(vexe string, imp_path string) string {
vcache.dlog('| Builder.' + @FN, 'vexe: $vexe | imp_path: $imp_path | rebuild_cmd: $rebuild_cmd')
os.system(rebuild_cmd)
rebuilded_o := v.pref.cache_manager.exists('.o', imp_path) or {
panic('could not rebuild cache module for $imp_path, error: $err')
panic('could not rebuild cache module for $imp_path, error: $err.msg')
}
os.chdir(pwd)
return rebuilded_o

View File

@ -2,5 +2,4 @@
module: main
function: buggy_function()
message: panicing...
file: vlib/v/tests/inout/panic_with_cg.vv
line: 3
file: vlib/v/tests/inout/panic_with_cg.vv:3