爛 code 收集器//空的 try,但是有寫 catch

  1. 爛 code 收集器//空的 try,但是有寫 catch

爛 code 收集器//空的 try,但是有寫 catch

原文連結: https://darkblack02.blogspot.com/2018/05/code-try-catch.html
移植時的最後更新日期: 2020-02-28T10:41:21.456+08:00

任何程式碼的刪除或添加,都必須要順過「上下文」,之後的人讀 code 才不會有這種驚喜!!!


void FuBase::MessageReceived(
string ChannelId, string MessageId, XmlElement &Data )
{
try
{
}
catch( std::exception & e )
{
log2File(“Occur Exception at [” +string( FUNC) + “] : " + string(e .what()) );
log2File(”[File: " + string( FILE) + “] (Line: " + IntToStr (LINE) + " )”, detail );
}
catch ( Exception& e )
{
log2File(“Occur Exception at [” +string( FUNC) + “] : " + string(e .Message. c_str()) );
log2File(”[File: " + string( FILE) + “] (Line: " + IntToStr (LINE) + " )”, detail );
}
catch(…)
{
log2File(“Occur exception at [” +string( FUNC) + “]” );
log2File("[File: " + string( FILE) + “] (Line: " + IntToStr (LINE) + " )”, detail );
}
}
無聲的聲音: 這是希望可以寫log嗎?