gpt4 book ai didi

c# - 在 c# om nom nom 中吃异常

转载 作者:可可西里 更新时间:2023-11-01 08:50:25 26 4
gpt4 key购买 nike

鉴于吃掉异常总是糟糕的 juju 并且重新抛出异常会丢失调用堆栈,重构以下内容的正确方法是什么?

饮食异常(exception):

try
{
… do something meaningful
}
catch(SomeException ex)
{
// eat exception
}

最佳答案

try
{
...
}
catch(SomeException e)
{
//Do whatever is needed with e
throw; //This rethrows and preserves call stack.
}

关于c# - 在 c# om nom nom 中吃异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3884328/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com