[log] fix error stack on flash platform

This commit is contained in:
2020-09-26 16:21:32 +03:00
parent f396c86a23
commit 163e6d68c3

View File

@@ -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 { 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)}');
} }
} }