facebook twitter hatena line email

「Unity/Csharp/Exception」の版間の差分

提供: 初心者エンジニアの簡易メモ
移動: 案内検索
(ページの作成:「==Exception例文== <pre> void Exec() { try { Hoge(); } catch (Exception e) { Debug.LogError(e.Message + ": [" + e.StackTrace + "] nam...」)
 
行10: 行10:
 
     {
 
     {
 
         Debug.LogError(e.Message + ": [" + e.StackTrace + "] name:" + e.GetType().Name);
 
         Debug.LogError(e.Message + ": [" + e.StackTrace + "] name:" + e.GetType().Name);
 +
        Debug.LogError(e.Message + " " + e);
 
     }
 
     }
 
}
 
}
行17: 行18:
 
}
 
}
 
</pre>
 
</pre>
出力
+
 
例外エラーNormal: [ at ExceptionScene.Exec () [0x00007] in unity/test/SentryProject/Assets/Scripts/Scene/ExceptionScene.cs:27 ] name:Exception
+
出力(e.StatkcTrace)
 +
<pre>
 +
at ExceptionScene.HogeAsync () [0x00074] in Assets/Scripts/Scene/ExceptionScene.cs:43
 +
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in ./Library/PackageCache/com.cysharp.unitask@b992a061fb/Runtime/CompilerServices/StateMachineRunner.cs:218
 +
  at ExceptionScene.Exec () [0x00023] in /Assets/Scripts/Scene/ExceptionScene.cs:26
 +
</pre>
 +
 
 +
出力(e.Message)
 +
例外エラーNormal
 +
 
 +
出力(e.GetType().Name)
 +
Exception
 +
 
 +
出力(e)
 +
<pre>
 +
System.Exception: 例外エラーAsync
 +
  at ExceptionScene.HogeAsync () [0x00074] in Assets/Scripts/Scene/ExceptionScene.cs:43
 +
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in ./Library/PackageCache/com.cysharp.unitask@b992a061fb/Runtime/CompilerServices/StateMachineRunner.cs:218
 +
  at ExceptionScene.Exec () [0x00023] in Assets/Scripts/Scene/ExceptionScene.cs:26
 +
</pre>
  
 
==関連==
 
==関連==
 
[[Unity/クラッシュ]] [ショートカット]
 
[[Unity/クラッシュ]] [ショートカット]

2023年10月3日 (火) 23:31時点における版

Exception例文

void Exec()
{
    try
    {
        Hoge();
    }
    catch (Exception e)
    {
        Debug.LogError(e.Message + ": [" + e.StackTrace + "] name:" + e.GetType().Name);
        Debug.LogError(e.Message + " " + e);
    }
}
void Hoge()
{
    throw new Exception("例外エラーNormal");
}

出力(e.StatkcTrace)

at ExceptionScene.HogeAsync () [0x00074] in Assets/Scripts/Scene/ExceptionScene.cs:43 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in ./Library/PackageCache/com.cysharp.unitask@b992a061fb/Runtime/CompilerServices/StateMachineRunner.cs:218 
  at ExceptionScene.Exec () [0x00023] in /Assets/Scripts/Scene/ExceptionScene.cs:26

出力(e.Message)

例外エラーNormal

出力(e.GetType().Name)

Exception

出力(e)

System.Exception: 例外エラーAsync
  at ExceptionScene.HogeAsync () [0x00074] in Assets/Scripts/Scene/ExceptionScene.cs:43 
  at Cysharp.Threading.Tasks.CompilerServices.AsyncUniTask`1[TStateMachine].GetResult (System.Int16 token) [0x00000] in ./Library/PackageCache/com.cysharp.unitask@b992a061fb/Runtime/CompilerServices/StateMachineRunner.cs:218 
  at ExceptionScene.Exec () [0x00023] in Assets/Scripts/Scene/ExceptionScene.cs:26

関連

Unity/クラッシュ [ショートカット]