Menu
Reference
- Manticore\Ds
- Async
- Classes
- AggregateError
- CancellationToken
- CancelledException
- Channel
- ChannelClosedException
- Context
- DeadlockException
- Mutex
- Once
- Pool
- Received
- SelectCase
- Selected
- Semaphore
- Settled
- Task
- TaskGroup
- TimeoutException
- Functions
- async()
- awaitAll()
- awaitAllSettled()
- awaitAny()
- channel()
- delay()
- dump()
- dumpOn()
- failure()
- group()
- mapConcurrent()
- mapSettled()
- readFile()
- select()
- selectNow()
- selectWithin()
- shield()
- shutdownOn()
- spawn()
- stats()
- timeout()
- watchdog()
- writeFile()
- Http
- Http\WebSocket
- Buffer
- Process
- Io\Poll
- Manticore\Sapi
- Ffi
failure()
function
function failure(): string
Where the last failure came from.
Names the task that raised it, the file:line it was spawned at, and the scope it sat in. A child's exception reaches you carrying the trace of whoever joined it, and the task that actually failed is not in that trace; this is recorded beside the exception, at the moment of failure. It names only the first real failure: the cancellation wave after it is not blamed on the tasks that were swept up.
try { async(fn() => work()); }
catch (\Throwable $e) { fwrite(STDERR, Async\failure()); }
// task #7 "worker" at jobs.php:31 raised RuntimeException: no such row
// in scope near jobs.php:12Returns
string — the report, or '' when the last run did not fail; reset by every async()
See also: dump, Task::named