visual-studio-code - 有没有办法抑制伴随 Julia REPL 错误的堆栈跟踪?

标签 visual-studio-code julia

有没有办法抑制伴随 Julia REPL 错误的堆栈跟踪(VS Code 特定方法可接受)?它在我的屏幕上填满了很多对我修复错误没有用的输出,我必须定期向上滚动以找到有用的、单一的、第一行错误描述,并发现它效率低下且困惑。

最佳答案

也许不是你想要的,但它很接近:

julia> # Sequence of dummy functions to generate long stack trace
       f() = g()
       g() = h()
       h() = k()
       k() = error("Hello world")
k (generic function with 2 methods)

julia> # Default: long stacktrace
       f()
ERROR: Hello world
Stacktrace:
 [1] error(::String) at ./error.jl:33
 [2] k() at ./REPL[72]:5
 [3] h() at ./REPL[72]:4
 [4] g() at ./REPL[72]:3
 [5] f() at ./REPL[72]:2
 [6] top-level scope at REPL[73]:2

julia> # try/catch to eliminate stacktrace
       try
           f()
       catch e
           printstyled(stderr,"ERROR: ", bold=true, color=:red)
           printstyled(stderr,sprint(showerror,e), color=:light_red)
           println(stderr)
       end
ERROR: Hello world

关于visual-studio-code - 有没有办法抑制伴随 Julia REPL 错误的堆栈跟踪?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61552981/

相关文章:

visual-studio-code - 为什么 VS Code 需要这么多内存?我怎样才能让它以更高的内存效率运行?

java - 在安装brew cask后缺少java源文件采用openjdk11

visual-studio-code - 如何在 VSCode 中更改光标颜色?

Julia:如何使直方图对于两个大小相同的向量具有相同数量的 bin?

julia - Julia 中是否存在 randsample 函数?

c++ - 如何在安装了 WSL 的 Visual Studio Code 中修复 "g++: error: helloworld.cpp: No such file or directory"?

javascript - JavaScript 文件中的 VS Code @ts-check 不检查所有内容 - 不存在的属性不会出错

arrays - 如何将向量的元素设置为指向数组数组中的第一个元素?

python - Julia 数据框与 Python Pandas

arrays - 为 julia 删除数组中的元素