|
|
|
|
|
|
public static class D { |
|
|
|
|
|
|
|
public static void logError(string message, Exception ex = null) { |
|
|
|
Debug.LogException(new ReportError(message, ex)); |
|
|
|
Debug.LogException(new AssertionError(message, ex)); |
|
|
|
} |
|
|
|
[Conditional("UIWidgets_DEBUG")] |
|
|
|
public static void assert(Func<bool> result, string message = null) { |
|
|
|
|
|
|
|
|
|
|
[Serializable] |
|
|
|
public class AssertionError : Exception { |
|
|
|
readonly Exception innerException; |
|
|
|
|
|
|
|
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 AssertionError(string message, Exception innerException = null) : base(message) { |
|
|
|
this.innerException = innerException; |
|
|
|
if (this.ex != null) { |
|
|
|
return this.ex.StackTrace; |
|
|
|
if (this.innerException != null) { |
|
|
|
return this.innerException.StackTrace; |
|
|
|
} |
|
|
|
|
|
|
|
var stackTrace = base.StackTrace; |
|
|
|
|
|
|
return string.Join("\n", strippedLines); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |