in agent/php/ElasticApm/Impl/ErrorExceptionData.php [107:160]
public static function build(Tracer $tracer, ?CustomErrorData $customErrorData, ?PhpErrorData $phpErrorData, ?Throwable $throwable, int $numberOfStackFramesToSkip): ErrorExceptionData
{
$result = new ErrorExceptionData();
if ($throwable !== null) {
$code = $throwable->getCode();
if (is_int($code)) {
$result->code = $code;
} elseif (is_string($code)) {
$result->code = Tracer::limitKeywordString($code);
}
$message = $throwable->getMessage();
if (is_string($message)) {
$result->message = $tracer->limitNullableNonKeywordString($message);
}
$namespace = '';
$shortName = '';
ClassNameUtil::splitFqClassName(get_class($throwable), /* ref */ $namespace, /* ref */ $shortName);
$result->module = TextUtil::isEmptyString($namespace) ? null : $namespace;
$result->type = TextUtil::isEmptyString($shortName) ? null : $shortName;
$result->stacktrace = $tracer->stackTraceUtil()->convertThrowableTraceToApmFormat($throwable, /* maxNumberOfFrames */ null);
}
if ($customErrorData !== null) {
if ($result->code === null) {
$result->code = is_string($customErrorData->code) ? Tracer::limitKeywordString($customErrorData->code) : $customErrorData->code;
}
if ($result->message === null) {
$result->message = $tracer->limitNullableNonKeywordString($customErrorData->message);
}
if ($result->module === null) {
$result->module = Tracer::limitNullableKeywordString($customErrorData->module);
}
if ($result->type === null) {
$result->type = Tracer::limitNullableKeywordString($customErrorData->type);
}
}
if ($result->stacktrace === null) {
if ($phpErrorData === null) {
$result->stacktrace = $tracer->stackTraceUtil()->captureInApmFormat($numberOfStackFramesToSkip, /* maxNumberOfFrames */ null);
} elseif ($phpErrorData->stackTrace !== null) {
$result->stacktrace = $tracer->stackTraceUtil()->convertPhpToApmFormat($phpErrorData->stackTrace, /* maxNumberOfFrames */ null);
}
}
return $result;
}