@@ -31,7 +31,7 @@ object TaskManager extends FunctionComponent[TaskManagerProps] {
3131 throw JavaScriptException (Error (" TaskManager.uiComponent is not specified" ))
3232 }
3333
34- useEffect ({ () =>
34+ useLayoutEffect ({ () =>
3535 props.startTask.foreach { task =>
3636 onTaskStart(setState, task)
3737 }
@@ -93,16 +93,16 @@ object TaskManager extends FunctionComponent[TaskManagerProps] {
9393 " %.3f" .format(durationMillis / 1000.0 )
9494 }
9595
96- private [task] def printStackTrace (x : Throwable ): String = {
96+ def printStackTrace (x : Throwable , sep : String = "   " ): String = {
9797 val sb = new StringBuilder (x.toString)
9898 val trace = x.getStackTrace
9999 for (t <- trace) {
100- sb.append(" \n\t at  " ).append(t)
100+ sb.append(s " \n\t at $sep " ).append(t)
101101 }
102102
103103 val cause = x.getCause
104104 if (cause != null ) {
105- printStackTraceAsCause(sb, cause, trace)
105+ printStackTraceAsCause(sb, cause, trace, sep )
106106 }
107107
108108 sb.toString
@@ -113,7 +113,8 @@ object TaskManager extends FunctionComponent[TaskManagerProps] {
113113 */
114114 private def printStackTraceAsCause (sb : StringBuilder ,
115115 cause : Throwable ,
116- causedTrace : Array [StackTraceElement ]): Unit = {
116+ causedTrace : Array [StackTraceElement ],
117+ sep : String ): Unit = {
117118
118119 // Compute number of frames in common between this and caused
119120 val trace = cause.getStackTrace
@@ -128,17 +129,17 @@ object TaskManager extends FunctionComponent[TaskManagerProps] {
128129 sb.append(" \n Caused by: " + cause)
129130
130131 for (i <- 0 to m) {
131- sb.append(" \n\t at  " ).append(trace(i))
132+ sb.append(s " \n\t at $sep " ).append(trace(i))
132133 }
133134
134135 if (framesInCommon != 0 ) {
135- sb.append(" \n\t ...  " ).append(framesInCommon).append("  more " )
136+ sb.append(s " \n\t ... $sep " ).append(framesInCommon).append(s " ${sep} more " )
136137 }
137138
138139 // Recurse if we have a cause
139140 val ourCause = cause.getCause
140141 if (ourCause != null ) {
141- printStackTraceAsCause(sb, ourCause, trace)
142+ printStackTraceAsCause(sb, ourCause, trace, sep )
142143 }
143144 }
144145}
0 commit comments