Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
たとえば、C# の InnerExceptions を含むすべての例外メッセージを簡単に取得して、コンソールやログに出力するにはどうすればよいですか?
これを行う最も簡単な方法は、再帰関数を記述することです。
例えば:
public static string ExceptionMessages(Exception ex) { if (ex.InnerException == null) { return ex.Message; } return ex.Message + " " + ExceptionMessages(ex.InnerException); }
これにより、すべてのメッセージが単一の文字列に出力されます。
私のアプリケーションのフォルダ構造は次のとおりです。
web/WEB-INF/templates/ -home.ftl web/resources/css/Home_files -test.css
<mvc:anno