DX: "TaskFailure: use Amp\Parallel\Worker\TaskException::getWorkerTrace() for the stack trace in the worker"
with my current code in https://github.com/FriendsOfPHP/PHP-CS-Fixer/pull/4838 at commit 7603b4b I am running into the following Exception:
$ time php php-cs-fixer fix ../redaxo/redaxo/src/core/
Loaded config default from "C:\xampp7.1.4\htdocs\PHP-CS-Fixer\.php_cs.dist".
Paths from configuration file have been overridden by paths provided as command arguments.
string(30) "PhpCsFixer\Linter\PooledLinter"
In TaskFailure.php line 69:
Uncaught Amp\Parallel\Sync\SerializationException in worker with message "The given data cannot be
sent because it is not serializable." and code "0"; use Amp\Parallel\Worker\TaskException::getWorkerTrace() for the stack trace in the worker
In TaskFailure.php line 69:
Uncaught Exception in worker with message "Serialization of 'Closure' is not allowed" and code "0"
; use Amp\Parallel\Worker\TaskException::getWorkerTrace() for the stack trace in the worker
fix [--path-mode PATH-MODE] [--allow-risky ALLOW-RISKY] [--config CONFIG] [--dry-run] [--rules RULES] [
--using-cache USING-CACHE] [--cache-file CACHE-FILE] [--diff] [--diff-format DIFF-FORMAT] [--format FOR
MAT] [--stop-on-violation] [--show-progress SHOW-PROGRESS] [--] [<path>...]
real 0m19.519s
user 0m0.000s
sys 0m0.061s
I am not sure what this error is trying to tell me:
use Amp\Parallel\Worker\TaskException::getWorkerTrace() for the stack trace in the worker
nowhere in the codebase I am using TaskFailure or TaskException. where do I need to catch/handle the mentioned TaskFailure (or TaskException?) to invoke getWorkerTrace() on it?
side-note: the suggested message seems to hint about a method call which is deprecated.
TaskException::getWorkerTrace() tells me to use getOriginalTraceAsString() instead
Worker::enqueue() returns a promise that can only fail with an instance of TaskFailureException or TaskFailureError, which both implement TaskFailureThrowable. The exception thrown by a Task is wrapped in a TaskFailure object and sent back to the parent, then re-thrown as one of those two classes.
I'm not sure you're actually using 1.3, as the exception message should now suggest using getOriginalTrace().
Closing as this issue is old and has not received further feedback. Please try v2 of this library when you get a chance, the API and error handling has been improved significantly.