@@ -21,27 +21,6 @@ namespace AElf.Runtime.CSharp;
2121
2222public class Executive : IExecutive
2323{
24- /// <summary>
25- /// Safely converts an exception to string without accessing StackTrace.
26- /// IMPORTANT: Do NOT call ex.ToString() as it accesses StackTrace property,
27- /// which can trigger StackOverflowException when the stack is nearly exhausted.
28- /// StackOverflowException cannot be caught by try-catch in .NET.
29- /// </summary>
30- private static string SafeExceptionToString ( Exception ex )
31- {
32- // Keep this method as simple as possible to minimize stack usage
33- // when the stack is nearly exhausted
34- try
35- {
36- // Only use GetType() and Message - these don't access StackTrace
37- return string . Concat ( ex . GetType ( ) . FullName , ": " , ex . Message ) ;
38- }
39- catch
40- {
41- return "Exception occurred" ;
42- }
43- }
44-
4524 private readonly ReadOnlyDictionary < string , IServerCallHandler > _callHandlers ;
4625 private readonly object _contractInstance ;
4726 private readonly ServerServiceDefinition _serverServiceDefinition ;
@@ -169,7 +148,7 @@ public void Execute()
169148 catch ( Exception ex )
170149 {
171150 CurrentTransactionContext . Trace . ExecutionStatus = ExecutionStatus . SystemError ;
172- CurrentTransactionContext . Trace . Error += SafeExceptionToString ( ex ) + "\n " ;
151+ CurrentTransactionContext . Trace . Error += ex + "\n " ;
173152 }
174153 finally
175154 {
@@ -206,7 +185,7 @@ private void ExecuteTransaction(IServerCallHandler handler)
206185 catch ( Exception ex )
207186 {
208187 CurrentTransactionContext . Trace . ExecutionStatus = ExecutionStatus . ContractError ;
209- CurrentTransactionContext . Trace . Error += SafeExceptionToString ( ex ) + "\n " ;
188+ CurrentTransactionContext . Trace . Error += ex + "\n " ;
210189 }
211190 }
212191
0 commit comments