master

laravel/framework

Last updated at: 29/12/2023 09:23

PostTooLargeException.php

TLDR

This file defines the PostTooLargeException class, which is a specialized exception for handling HTTP 413 "post too large" errors.

Classes

PostTooLargeException

This class extends the HttpException class from the Symfony component and represents an exception that is thrown when a request payload exceeds the server's maximum allowable size. It provides a convenient way to create a new instance of this exception with a custom message, previous exception, headers, and error code.

<?php

namespace Illuminate\Http\Exceptions;

use Symfony\Component\HttpKernel\Exception\HttpException;
use Throwable;

class PostTooLargeException extends HttpException
{
    /**
     * Create a new "post too large" exception instance.
     *
     * @param  string  $message
     * @param  \Throwable|null  $previous
     * @param  array  $headers
     * @param  int  $code
     * @return void
     */
    public function __construct($message = '', Throwable $previous = null, array $headers = [], $code = 0)
    {
        parent::__construct(413, $message, $previous, $headers, $code);
    }
}