浏览代码

Merge branch 'material' into 'master'

logError fix

See merge request upm-packages/ui-widgets/com.unity.uiwidgets!69
/main
Shenhua Gu 6 年前
当前提交
793a3f64
共有 8 个文件被更改,包括 39 次插入23 次删除
  1. 2
      Runtime/async/coroutine.cs
  2. 2
      Runtime/async/microtask_queue.cs
  3. 5
      Runtime/async/timer.cs
  4. 1
      Runtime/engine/DisplayMetrics.cs
  5. 17
      Runtime/foundation/assertions.cs
  6. 31
      Runtime/foundation/debug.cs
  7. 2
      Runtime/gestures/binding.cs
  8. 2
      Runtime/gestures/pointer_router.cs

2
Runtime/async/coroutine.cs


callbackNode.callback();
}
catch (Exception ex) {
Debug.LogError("Failed to execute callback in BackgroundCallbacks: " + ex);
D.logError("Failed to execute callback in BackgroundCallbacks: ", ex);
}
if (!callbackNode.isDone) {

2
Runtime/async/microtask_queue.cs


action();
}
catch (Exception ex) {
Debug.LogError("Error to execute microtask: " + ex);
D.logError("Error to execute microtask: ", ex);
}
}
}

5
Runtime/async/timer.cs


using System;
using System.Collections.Generic;
using Unity.UIWidgets.foundation;
using UnityEngine;
#if UNITY_EDITOR
using UnityEditor;

callback();
}
catch (Exception ex) {
Debug.LogError("Error to execute runInMain callback: " + ex);
D.logError("Error to execute runInMain callback: ", ex);
}
}
}

this._callback();
}
catch (Exception ex) {
Debug.LogError("Error to execute timer callback: " + ex);
D.logError("Error to execute timer callback: ", ex);
}
if (this.periodic) {

1
Runtime/engine/DisplayMetrics.cs


using System;
using System.Runtime.InteropServices;
namespace Unity.UIWidgets.engine {
public class DisplayMetrics {

17
Runtime/foundation/assertions.cs


}
}
public class UIWidgetsError : AssertionError {
public class UIWidgetsError : Exception {
static int _errorCount = 0;
public static void resetErrorCount() {
_errorCount = 0;
}
public static void dumpErrorToConsole(UIWidgetsErrorDetails details) {
dumpErrorToConsole(details, forceReport: false);

return;
}
if (_errorCount == 0 || forceReport) {
Debug.LogError(details.ToString());
}
else {
Debug.LogWarning("Another exception was thrown: " + details);
}
_errorCount += 1;
D.logError(details.ToString(), details.exception);
}
public static IEnumerable<string> defaultStackFilter(IEnumerable<string> frames) {

31
Runtime/foundation/debug.cs


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);

2
Runtime/gestures/binding.cs


entry.target.handleEvent(evt, entry);
}
catch (Exception ex) {
Debug.LogError("Error while dispatching a pointer event: " + ex);
D.logError("Error while dispatching a pointer event: ", ex);
}
}
}

2
Runtime/gestures/pointer_router.cs


route(evt);
}
catch (Exception ex) {
Debug.LogError("Error while routing a pointer event: " + ex);
D.logError("Error while routing a pointer event: ", ex);
}
}

正在加载...
取消
保存