static getArtifactRuntimeError(artifacts) {
    /** @type {Array<[string, LighthouseError|object]>} */
    const possibleErrorArtifacts = [
      ['PageLoadError', artifacts.PageLoadError], // Preferentially use `PageLoadError`, if it exists.
      ...Object.entries(artifacts), // Otherwise check amongst all artifacts.
    ];

    for (const [artifactKey, possibleErrorArtifact] of possibleErrorArtifacts) {
      const isError = possibleErrorArtifact instanceof LighthouseError;

      if (isError && possibleErrorArtifact.lhrRuntimeError) {
        const errorMessage = possibleErrorArtifact.friendlyMessage || possibleErrorArtifact.message;
        // Prefer the stack trace closest to the error.
        const stack =
          /** @type {any} */ (possibleErrorArtifact.cause)?.stack ?? possibleErrorArtifact.stack;

        return {
          code: possibleErrorArtifact.code,
          message: errorMessage,
          errorStack: stack,
          artifactKey,
        };
      }
    }

    return undefined;
  }
Searches a pass's artifacts for any `lhrRuntimeError` error artifacts.
Returns the first one found or `null` if none found.
@param {LH.Artifacts} artifacts
@return {LH.RawIcu<LH.Result['runtimeError']>|undefined}