どうすれば例外を適切にスローできますか?
public void Test()
{
if (error != 0) {
string msg = "Error";
throw new Exception(msg);
}
// Other function
...
}
私もthrow new Exception(msg);
ロガーで変更しました
public void Test()
{
if (error != 0) {
string msg = "Error";
//throw new Exception(msg);
logger.Error(msg);
}
// Other function
...
}
エラーが発生したときに関数を終了するには、Exit関数を使用する必要がありますか?
よろしくお願いします。