|
|
|
|
|
|
using System.Diagnostics; |
|
|
|
using System.Linq; |
|
|
|
using Unity.UIWidgets.ui; |
|
|
|
using Debug = UnityEngine.Debug; |
|
|
|
|
|
|
|
public static void logError(string message, Exception ex = null) { |
|
|
|
Debug.LogException(new ReportError(message, ex)); |
|
|
|
} |
|
|
|
assert(result(), message); |
|
|
|
if (!result()) { |
|
|
|
throw new AssertionError(message); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
[Conditional("UIWidgets_DEBUG")] |
|
|
|
|
|
|
|
|
|
|
public override string StackTrace { |
|
|
|
get { |
|
|
|
var stackTrace = base.StackTrace; |
|
|
|
var lines = stackTrace.Split('\n'); |
|
|
|
var strippedLines = lines.Skip(1); |
|
|
|
|
|
|
|
return string.Join("\n", strippedLines); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public class ReportError : Exception { |
|
|
|
Exception ex; |
|
|
|
public ReportError(string message, Exception ex = null) : base(message) { |
|
|
|
this.ex = ex; |
|
|
|
} |
|
|
|
|
|
|
|
public override string StackTrace { |
|
|
|
get { |
|
|
|
if (this.ex != null) { |
|
|
|
return this.ex.StackTrace; |
|
|
|
} |
|
|
|
|
|
|
|
var stackTrace = base.StackTrace; |
|
|
|
var lines = stackTrace.Split('\n'); |
|
|
|
var strippedLines = lines.Skip(1); |
|
|
|