From 163e6d68c36fba310eb2e783e13e1c7accc913d8 Mon Sep 17 00:00:00 2001 From: shmyga Date: Sat, 26 Sep 2020 16:21:32 +0300 Subject: [PATCH] [log] fix error stack on flash platform --- src/main/hw/log/BaseLogger.hx | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/main/hw/log/BaseLogger.hx b/src/main/hw/log/BaseLogger.hx index 4989979..36f1825 100755 --- a/src/main/hw/log/BaseLogger.hx +++ b/src/main/hw/log/BaseLogger.hx @@ -20,8 +20,17 @@ class LoggerUtil { } } + public static function getErrorStack(error:Dynamic):String { + #if flash + if (Std.is(error, flash.errors.Error)) { + return cast(error, flash.errors.Error).getStackTrace(); + } + #end + return CallStack.exceptionStack().map(printStackItem).join('\n\t'); + } + public static function printError(error:Dynamic):String { - return error == null ? '' : Std.string('${error}\n\t${CallStack.exceptionStack().map(printStackItem).join('\n\t')}'); + return error == null ? '' : Std.string('${error}\n\t${getErrorStack(error)}'); } }