class ExceptionReporter (View source)

Properties

protected bool $reportingViewException

Indicates the currently reporting exception is a view exception.

protected BladeMapper|null $bladeMapper

The Blade mapper resolved for the currently reporting exception.

protected Throwable, string> $exceptionIds

The captured identifiers, keyed by exception.

protected float|null $octaneRequestReceivedAt

The time the Octane request was received.

protected string|null $currentlyRunningCommandName

The name of the currently running Artisan command.

protected string|null $artisanCommandTraceId

The trace ID for the current artisan command execution.

protected Input|null $currentConsoleInput

The console input of the currently running Artisan command.

protected ArgvInput|null $currentFallbackArgvInput

The console input built from the process arguments. Fallback when console input is not yet set.

protected Event|null $currentlyRunningScheduledTask

The currently running scheduled task.

protected bool $scheduledTaskAwaitingFailureReport

Indicates the currently running scheduled task has finished with its failure yet to be reported.

protected Job|null $currentlyProcessingJob

The currently executing job on the queue.

protected string|null $currentlyProcessingJobAttemptId

The currently executing job attempt ID.

protected array<string, string> $normalizedQueues

The cached normalized queue names, keyed by "connection:queue".

protected array<string, mixed>|null $connectionConfig

The cached queue configuration.

protected array{job: array<string, mixed>, scheduled_task: array<string, mixed>} $executionContext

Proactively captured execution context, keyed by execution type.

protected string|null $reservedMemory

The memory reserved for reporting fatal errors.

Methods

__construct(Events $events, Closure $bladeMapperResolver, string $basePath, array $config)

Create a new Exception Reporter instance.

bool|null
__invoke(Throwable $e)

Report the given exception.

string
exceptionId(Throwable $e)

Retrieve the identifier for the given exception.

unwrapViewException(Throwable $e)

Unwrap view exceptions and remember the original exception.

bool
isViewException(Throwable $e)

Determine if the given exception is a view exception.

array
payload(Throwable $e)

Create the exception payload.

string
timestamp()

Retrieve the current timestamp.

object|null
exceptionContext(Throwable $e)

Retrieve the context for the given exception.

object|null
laravelContext()

Retrieve the current Laravel Context.

array
executionDetails(Throwable $e)

Retrieve the execution context.

void
prepareForOctaneRequest()

Prepare for an incoming Octane request.

array
requestExecutionDetails(Throwable $e)

Retrieve the request execution context.

array|null
requestHeaders()

Retrieve the request headers.

void
removeSyntheticAuthorizationHeaders(HeaderBag $headers)

Remove the headers PHP derives from the Authorization header.

void
redactHeaders(HeaderBag $headers)

Redact the configured sensitive headers.

string
redactAuthorizationHeaderValue(string $value)

Redact the given authorization header value, retaining the scheme.

string
redactCookieHeaderValue(string $value)

Redact the given cookie header value, retaining the cookie names.

string
requestUrl()

Retrieve the requested URL.

array|null
requestRouteExecutionDetails()

Retrieve the route specific request execution context.

array|null
requestPayload(Throwable $e)

Retrieve the request payload.

array
redactRequestPayload(array $payload)

Redact the configured sensitive fields in the given payload.

bool
shouldRedactRequestPayloadField(string $field, mixed $value)

Determine if the given payload field should be redacted.

array|null
requestFiles(Throwable $e)

Retrieve the parsed uploaded files.

array
parseRequestFiles(array $files)

Parse the given uploaded files into their reportable details.

void
prepareForCommand(string $name, InputInterface $input)

Prepare to process the given command.

array
consoleCommandExecutionDetails(Throwable $e)

Retrieve the console execution context.

string
consoleCommandTraceId()

Retrieve the console command execution trace ID.

string|null
consoleCommandName()

Retrieve the name of the currently running Artisan command.

string|null
consoleCommandClass()

Retrieve the class name of the currently running Artisan command.

string|null
consoleCommandLine()

Retrieve the redacted command line.

callable
consoleArgumentTransformer(string $name)

Retrieve a transformer for the given console argument.

callable
consoleOptionTransformer(string $name)

Retrieve a transformer for the given console option.

array
applyTransformationToConsoleInputValue(null|bool|string|array $value, callable $transformer)

Apply the given transformation to each of the given input's values.

bool
shouldRedactConsoleInputValue(string $name)

Determine if the given command argument or option should be redacted.

Input
currentConsoleInput()

Retrieve the console input of the currently running Artisan command.

ArgvInput
currentFallbackArgvInput()

Retrieve the fallback console input built from the process arguments.

void
prepareForScheduledTask(Event $task)

Prepare to run the given scheduled task.

void
finishScheduledTask(Event $task)

Handle the given scheduled task finishing.

void
flushScheduledTaskContext()

Flush the currently running scheduled task context.

bool
isRunningScheduledTask()

Determine if a scheduled task is running.

array
scheduledTaskExecutionDetails(Throwable $e)

Retrieve the currently running scheduled task's execution context.

string
scheduledTaskName()

Retrieve the name of the currently running scheduled task.

string
scheduledCallbackTaskName()

Retrieve the name of the currently running scheduled callback task.

string
scheduledClosureTaskName(Closure $callback)

Retrieve the name of the given scheduled closure task.

string|null
scheduledTaskClass()

Retrieve the class name of the currently running scheduled task.

string|null
scheduledCallbackTaskClass()

Retrieve the class name of the currently running scheduled callback task.

mixed
scheduledTaskCallback()

Retrieve the callback of the currently running scheduled task.

string|null
scheduledTaskTimezone()

Retrieve the timezone of the currently running scheduled task.

void
prepareForJob(Job $job)

Prepare to process the given job.

void
flushJobContext()

Flush currently processing job context.

bool
isProcessingJob()

Determine if a queue worker is running.

array
jobExecutionDetails(Throwable $e)

Retrieve the currently processing job's execution context.

string|null
traceIdFromContext()

Retrieve the trace identifier the current job belongs to.

string
currentlyProcessingJobAttemptId()

The currently processing job attempt ID.

string
normalizedQueue()

Normalize the given queue name.

void
rememberUser(Authenticatable $user)

Remember the given user as they log out.

void
handleContextDehydrating(Repository $context)

Handle context dehydrating.

void
rememberUserIdInContext(Repository $context)

Capture the authenticated user's identifier in the given context.

void
rememberTraceIdInContext(Repository $context)

Capture the trace identifier of the current execution in the given context.

string|null
userId()

Retrieve the current user ID.

string|null
userIdFromContext()

Retrieve the authenticated user's identifier from the context.

string|null
userIdentifier(Authenticatable $user)

Retrieve the identifier of the given user.

bool
handled(Throwable $e)

Determine if the exception was handled.

array
parseException(Throwable $e)

Parse the given exception.

array
previous(Throwable $e)

Parse the previous exceptions.

array
trace(Throwable $e)

Parse the stack trace for the given exception.

string|array
argType(mixed $argument, string|int $name)

Determine the type information of the given argument.

array
normalizeFrameFileAndLine(array $frame)

Normalize the file and line number.

array
mapCompiledViewFrame(array $frame)

Map compiled views to their original view file paths.

bladeMapper()

Retrieve the Blade mapper.

string
redactValue(string $value)

Redact the given value.

string
normalizeBasePath(string $path)

Normalize the file path's base path.

string|null
laravelStartedAtTimestamp()

Retrieve the time Laravel started.

Details

__construct(Events $events, Closure $bladeMapperResolver, string $basePath, array $config)

Create a new Exception Reporter instance.

Parameters

Events $events
Closure $bladeMapperResolver
string $basePath
array $config

bool|null __invoke(Throwable $e)

Report the given exception.

Parameters

Throwable $e

Return Value

bool|null

string exceptionId(Throwable $e)

Retrieve the identifier for the given exception.

Parameters

Throwable $e

Return Value

string

protected Throwable unwrapViewException(Throwable $e)

Unwrap view exceptions and remember the original exception.

Parameters

Throwable $e

Return Value

Throwable

protected bool isViewException(Throwable $e)

Determine if the given exception is a view exception.

Parameters

Throwable $e

Return Value

bool

protected array payload(Throwable $e)

Create the exception payload.

Parameters

Throwable $e

Return Value

array

protected string timestamp()

Retrieve the current timestamp.

Return Value

string

protected object|null exceptionContext(Throwable $e)

Retrieve the context for the given exception.

Parameters

Throwable $e

Return Value

object|null

protected object|null laravelContext()

Retrieve the current Laravel Context.

Return Value

object|null

protected array executionDetails(Throwable $e)

Retrieve the execution context.

Parameters

Throwable $e

Return Value

array

void prepareForOctaneRequest()

Prepare for an incoming Octane request.

Return Value

void

protected array requestExecutionDetails(Throwable $e)

Retrieve the request execution context.

Parameters

Throwable $e

Return Value

array

protected array|null requestHeaders()

Retrieve the request headers.

Return Value

array|null

protected void removeSyntheticAuthorizationHeaders(HeaderBag $headers)

Remove the headers PHP derives from the Authorization header.

Parameters

HeaderBag $headers

Return Value

void

protected void redactHeaders(HeaderBag $headers)

Redact the configured sensitive headers.

Parameters

HeaderBag $headers

Return Value

void

protected string redactAuthorizationHeaderValue(string $value)

Redact the given authorization header value, retaining the scheme.

Parameters

string $value

Return Value

string

protected string redactCookieHeaderValue(string $value)

Redact the given cookie header value, retaining the cookie names.

Parameters

string $value

Return Value

string

protected string requestUrl()

Retrieve the requested URL.

Return Value

string

protected array|null requestRouteExecutionDetails()

Retrieve the route specific request execution context.

Return Value

array|null

protected array|null requestPayload(Throwable $e)

Retrieve the request payload.

Parameters

Throwable $e

Return Value

array|null

protected array redactRequestPayload(array $payload)

Redact the configured sensitive fields in the given payload.

Parameters

array $payload

Return Value

array

protected bool shouldRedactRequestPayloadField(string $field, mixed $value)

Determine if the given payload field should be redacted.

Parameters

string $field
mixed $value

Return Value

bool

protected array|null requestFiles(Throwable $e)

Retrieve the parsed uploaded files.

Parameters

Throwable $e

Return Value

array|null

protected array parseRequestFiles(array $files)

Parse the given uploaded files into their reportable details.

Values are uploaded files, or nested arrays of them.

Parameters

array $files

Return Value

array

void prepareForCommand(string $name, InputInterface $input)

Prepare to process the given command.

Parameters

string $name
InputInterface $input

Return Value

void

protected array consoleCommandExecutionDetails(Throwable $e)

Retrieve the console execution context.

Parameters

Throwable $e

Return Value

array

protected string consoleCommandTraceId()

Retrieve the console command execution trace ID.

Return Value

string

protected string|null consoleCommandName()

Retrieve the name of the currently running Artisan command.

Return Value

string|null

protected string|null consoleCommandClass()

Retrieve the class name of the currently running Artisan command.

Return Value

string|null

protected string|null consoleCommandLine()

Retrieve the redacted command line.

Return Value

string|null

protected callable consoleArgumentTransformer(string $name)

Retrieve a transformer for the given console argument.

Parameters

string $name

Return Value

callable

protected callable consoleOptionTransformer(string $name)

Retrieve a transformer for the given console option.

Parameters

string $name

Return Value

callable

protected array applyTransformationToConsoleInputValue(null|bool|string|array $value, callable $transformer)

Apply the given transformation to each of the given input's values.

Parameters

null|bool|string|array $value
callable $transformer

Return Value

array

protected bool shouldRedactConsoleInputValue(string $name)

Determine if the given command argument or option should be redacted.

Parameters

string $name

Return Value

bool

protected Input currentConsoleInput()

Retrieve the console input of the currently running Artisan command.

Return Value

Input

protected ArgvInput currentFallbackArgvInput()

Retrieve the fallback console input built from the process arguments.

Return Value

ArgvInput

void prepareForScheduledTask(Event $task)

Prepare to run the given scheduled task.

Parameters

Event $task

Return Value

void

void finishScheduledTask(Event $task)

Handle the given scheduled task finishing.

Parameters

Event $task

Return Value

void

void flushScheduledTaskContext()

Flush the currently running scheduled task context.

Return Value

void

protected bool isRunningScheduledTask()

Determine if a scheduled task is running.

Return Value

bool

protected array scheduledTaskExecutionDetails(Throwable $e)

Retrieve the currently running scheduled task's execution context.

Parameters

Throwable $e

Return Value

array

protected string scheduledTaskName()

Retrieve the name of the currently running scheduled task.

Return Value

string

protected string scheduledCallbackTaskName()

Retrieve the name of the currently running scheduled callback task.

Return Value

string

protected string scheduledClosureTaskName(Closure $callback)

Retrieve the name of the given scheduled closure task.

Parameters

Closure $callback

Return Value

string

protected string|null scheduledTaskClass()

Retrieve the class name of the currently running scheduled task.

Return Value

string|null

protected string|null scheduledCallbackTaskClass()

Retrieve the class name of the currently running scheduled callback task.

Return Value

string|null

protected mixed scheduledTaskCallback()

Retrieve the callback of the currently running scheduled task.

Return Value

mixed

protected string|null scheduledTaskTimezone()

Retrieve the timezone of the currently running scheduled task.

Return Value

string|null

void prepareForJob(Job $job)

Prepare to process the given job.

Parameters

Job $job

Return Value

void

void flushJobContext()

Flush currently processing job context.

Return Value

void

protected bool isProcessingJob()

Determine if a queue worker is running.

Return Value

bool

protected array jobExecutionDetails(Throwable $e)

Retrieve the currently processing job's execution context.

Parameters

Throwable $e

Return Value

array

protected string|null traceIdFromContext()

Retrieve the trace identifier the current job belongs to.

Return Value

string|null

protected string currentlyProcessingJobAttemptId()

The currently processing job attempt ID.

Return Value

string

protected string normalizedQueue()

Normalize the given queue name.

Return Value

string

void rememberUser(Authenticatable $user)

Remember the given user as they log out.

Parameters

Authenticatable $user

Return Value

void

void handleContextDehydrating(Repository $context)

Handle context dehydrating.

Parameters

Repository $context

Return Value

void

protected void rememberUserIdInContext(Repository $context)

Capture the authenticated user's identifier in the given context.

Parameters

Repository $context

Return Value

void

protected void rememberTraceIdInContext(Repository $context)

Capture the trace identifier of the current execution in the given context.

Parameters

Repository $context

Return Value

void

protected string|null userId()

Retrieve the current user ID.

Return Value

string|null

protected string|null userIdFromContext()

Retrieve the authenticated user's identifier from the context.

Return Value

string|null

protected string|null userIdentifier(Authenticatable $user)

Retrieve the identifier of the given user.

Parameters

Authenticatable $user

Return Value

string|null

protected bool handled(Throwable $e)

Determine if the exception was handled.

Parameters

Throwable $e

Return Value

bool

protected array parseException(Throwable $e)

Parse the given exception.

Parameters

Throwable $e

Return Value

array

protected array previous(Throwable $e)

Parse the previous exceptions.

Parameters

Throwable $e

Return Value

array

protected array trace(Throwable $e)

Parse the stack trace for the given exception.

Parameters

Throwable $e

Return Value

array

protected string|array argType(mixed $argument, string|int $name)

Determine the type information of the given argument.

Parameters

mixed $argument
string|int $name

Return Value

string|array

protected array normalizeFrameFileAndLine(array $frame)

Normalize the file and line number.

Parameters

array $frame

Return Value

array

protected array mapCompiledViewFrame(array $frame)

Map compiled views to their original view file paths.

Parameters

array $frame

Return Value

array

protected BladeMapper bladeMapper()

Retrieve the Blade mapper.

The mapper is only needed while reporting a view exception, and is resolved when it is first needed.

Return Value

BladeMapper

protected string redactValue(string $value)

Redact the given value.

Parameters

string $value

Return Value

string

protected string normalizeBasePath(string $path)

Normalize the file path's base path.

Parameters

string $path

Return Value

string

protected string|null laravelStartedAtTimestamp()

Retrieve the time Laravel started.

Return Value

string|null