Создание исключение из массива, описывающего параметры исключения
Обратная функция для __toArray()
@param array $errors
@return Error
486080
static function createFromArray($errors)
    {
        if (is_array($errors)){
            if (isset($errors['code'], $errors['message'])){
                $result = new Error($errors['message'], $errors['code']);
                if (isset($errors['children']) && is_array($errors['children'])){
                    foreach ($errors['children'] as $name => $e){
                        $result->add(self::createFromArray($e));
                    }
                }
                return $result;
            }
        }
        return new Error();
    }
1237285
public function deleteBannedEmailFailed(array $errors)
    {
        $url     = handles('antares::ban_management/bannedemails/datatable');
        $message = trans('antares/ban_management::response.bannedemails.delete.db-failed', $errors);

        return $this->redirectWithMessage($url, $message, 'error');
    }
1065874
public function errors($format = 'array')
    {
        $errorMessage = '';
        $errors = Session::get('errors') ?: false;

        if (!$errors) {
            return false;
        }

        if ($format === 'string') {
            foreach ($errors as $error => $message) {
                $errorMessage .= $message.'<br>';
            }
        } else {
            $errorMessage = Session::get('errors');
        }

        return $errorMessage;
    }
1236451
public function storeBannedEmailFailed(array $errors)
    {
        $url     = handles('antares::ban_management/bannedemails/datatable');
        $message = trans('antares/ban_management::response.bannedemails.create.db-failed', $errors);

        return $this->redirectWithMessage($url, $message, 'error');
    }
933778
public function deleteRuleFailed(array $errors)
    {
        $url     = handles('antares::ban_management/rules/datatable');
        $message = trans('antares/ban_management::response.rules.delete.db-failed', $errors);

        return $this->redirectWithMessage($url, $message, 'error');
    }
1145883
private function parseErrorSection(array $errors)
    {
        if (array_key_exists('invalidFilters', $errors)) {
            $this->jsonErrors[] = new JSONError(JSONError::INVALID_FILTER, $errors['invalidFilters']);
        }
        if (array_key_exists('invalidQueryParams', $errors)) {
            $this->jsonErrors[] = new JSONError(JSONError::INVALID_QUERYPARAMS, $errors['invalidQueryParams']);
        }
        if (array_key_exists('invalidLanguage', $errors)) {
            $this->jsonErrors[] = new JSONError();
        }
    }
1178952
private function pluckError(array $error) {
        $row = array_intersect_key(
            $error,
            ['field' => 1, 'error' => 1, 'code' => 1]
        );

        $row['message'] = $this->formatErrorMessage($error);
        return $row;
    }
757899
public function toArray()
    {
        $errorInfo['code'] = $this->getCode();
        $errorInfo['context'] = $this->getContext();
        $errorInfo['message'] = htmlentities($this->getMessage());

        if (config('app.debug', false)) {
            $trace = $this->getTraceAsString();
            $trace = str_replace(["\n", "#"], ["", "<br>"], $trace);
            $traceArray = explode("<br>", $trace);
            $cleanTrace = [];
            foreach ($traceArray as $k => $v) {
                if (!empty($v)) {
                    $cleanTrace[] = $v;
                }
            }
            $errorInfo['trace'] = $cleanTrace;
        }

        return $errorInfo;
    }
526582
public function response(array $errors): JsonResponse
    {
        return $this->respondValidationError(
            ApiResponse::CODE_VALIDATION_ERROR,
            $this->transformErrors($errors)
        );
    }
279991
static function errors($errors)
    {
        if (empty($errors)) {
            return self::error500('Ошибка при выполнении запроса');
        } else {
            $many_errors = [];

            foreach ($errors as $error) {
                $one_error = [
                    'status' => empty($error[0]) ? '500 Internal Server Error' : $error[0],
                    'code'   => empty($error[1]) ? 'danger' : $error[1],
                    'title'  => empty($error[2]) ? 'Ошибка при выполнении запроса' : $error[2],
                ];

                if (!empty($error[3])) {
                    $one_error['meta'] = $error[3];
                }

                $many_errors[] = $one_error;
            }

            return [
                'errors' => $many_errors,
            ];
        }
    }
27113
public function formatErrors(array $errors)
   {
      $tmp = [];
      $len = count($errors);
      if ($len === 0) {
         throw new InvalidArgumentException(
            "invalid value provided for 'errors'; expecting an array that ".
            "contains at least one instance of sndsgd\\field\\Error"
         );
      }

      $noun = ($len === 1) ? 'option' : 'options';
      $tmp = ["failed to process $noun"];
      foreach ($errors as $error) {
         $name = $error->getName();
         $message = $error->getMessage();
         if (!array_key_exists($name, $tmp)) {
            $tmp[$name] = " @[bold]$name@[reset] → $message";
         }
      }
      return implode(PHP_EOL, array_values($tmp)).PHP_EOL;
   }
484197
protected function setError($error) {
		
		$this->error = array();
		
		foreach (func_get_args() as $err) {
			if (is_array($err)) {
				$this->error = array_merge($this->error, $err);
			} else {
				$this->error[] = $err;
			}
		}
		
		// $this->error = is_array($error) ? $error : func_get_args();
		return false;
	}
990603
public function storeRuleFailed(array $errors)
    {
        $url     = handles('antares::ban_management/rules/datatable');
        $message = trans('antares/ban_management::response.rules.create.db-failed', $errors);

        return $this->redirectWithMessage($url, $message, 'error');
    }
501305
public function addError($error)
    {
        if (is_array($error)) {
            $this->errors += $error;
        } else {
            $this->errors[] = $error;
        }

        return $this;
    }
61030
private function fetchAllErrorDescription(array $errorArray): array
    {
        $allErrorDescription = [];

        foreach ($errorArray[self::FIELD_ERROR] as $error) {
            $description = $error[self::FIELD_ERROR_DESCRIPTION];
            $allErrorDescription[] = $description;
        }

        return $allErrorDescription;
    }
257919
protected function _toData($errors)
    {
        $data = array();

        foreach ($errors as $error) {
            if ($error instanceof Exception) {
                $data[] = array('code' => $error->getCode(),'message' => $error->getMessage());
            } elseif ($error instanceof AnError) {
                $data[] = $error->toArray();
            }
        }

        return $data;
    }
997705
protected function writeErrorAndDie(array $errors)
    {
        $output = (new ConsoleOutput)->getErrorOutput();

        foreach ($errors as $error) {
            $output->writeln($error);
        }

        die(1);
    }