From 3278df2812fd630ba3526eb061f848b887df052a Mon Sep 17 00:00:00 2001 From: James Harkins Date: Tue, 24 Jan 2012 17:31:09 +0800 Subject: [PATCH] Bugfix: Error in a routine on appclock hides the routine's stack trace To reproduce: AppClock.sched(0.1, r { "bang".skribble }); --- SCClassLibrary/Common/Core/Error.sc | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/SCClassLibrary/Common/Core/Error.sc b/SCClassLibrary/Common/Core/Error.sc index 059e986a2..7e93388e9 100644 --- a/SCClassLibrary/Common/Core/Error.sc +++ b/SCClassLibrary/Common/Core/Error.sc @@ -30,7 +30,7 @@ Exception { ^this.errorString.tr($ , $_).tr($\n, $_); } postProtectedBacktrace { - var out, currentFrame, def, ownerClass, methodName, pos = 0; + var out, currentFrame, def, ownerClass, methodName, pos; out = CollStream.new; "\nPROTECTED CALL STACK:".postln; currentFrame = protectedBacktrace; @@ -57,7 +57,16 @@ Exception { }); // lose everything after the last Function:protect // it just duplicates the normal stack with less info - out.collection.copyFromStart(pos).postln; + // but, an Error in a routine in a Scheduler + // may not have a try/protect in the protectedBacktrace + // then, pos is nil and we should print everything + postln( + if(pos.notNil) { + out.collection.copyFromStart(pos) + } { + out.collection + } + ); } isException { ^true } -- 2.11.4.GIT