exceptions

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 14, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package exceptions mirrors Illuminate\Routing\Exceptions.

The files it answers to, in the clone at laravel_illuminate/routing/Exceptions:

BackedEnumCaseNotFoundException.php
InvalidSignatureException.php
MissingRateLimiterException.php
StreamedResponseException.php
UrlGenerationException.php

Nothing is implemented here yet. docs/31-reorganizacao-hesape.md says what moves in, from where, and in which phase.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackedEnumCaseNotFoundError

type BackedEnumCaseNotFoundError struct {
	Class string
	Value string
}

BackedEnumCaseNotFoundError is the error when a parameter value does not match any case of the expected backed enum.

It mirrors Illuminate\Routing\Exceptions\BackedEnumCaseNotFoundException.

func (*BackedEnumCaseNotFoundError) Error

type GeneratedRoute

type GeneratedRoute interface {
	// GetName is Route::getName.
	GetName() string
	// URI is Route::uri.
	URI() string
}

GeneratedRoute is what ForMissingParameters needs from a route: its name and its URI, the two halves of the message.

It is an interface and not the route type because routing imports this package to raise the error, and naming the route type here would be a cycle. hesape/routing.Route satisfies it.

type InvalidSignatureError

type InvalidSignatureError struct {
	Message string
}

InvalidSignatureError is returned when a signed URL fails verification.

It mirrors Illuminate\Routing\Exceptions\InvalidSignatureException.

func (*InvalidSignatureError) Error

func (e *InvalidSignatureError) Error() string

type MissingRateLimiterError

type MissingRateLimiterError struct {
	Name string
}

MissingRateLimiterError is returned when a named rate limiter has not been registered.

It mirrors Illuminate\Routing\Exceptions\MissingRateLimiterException.

func ForLimiter

func ForLimiter(limiter string) *MissingRateLimiterError

ForLimiter is MissingRateLimiterException::forLimiter.

func ForLimiterAndUser

func ForLimiterAndUser(limiter, model string) *MissingRateLimiterError

ForLimiterAndUser is MissingRateLimiterException::forLimiterAndUser. The model is the type whose property named the limiter, so the message says which of the two halves is missing.

func (*MissingRateLimiterError) Error

func (e *MissingRateLimiterError) Error() string

type StreamedResponseError

type StreamedResponseError struct {
	Err error
}

StreamedResponseError wraps an error thrown during streamed response generation.

It mirrors Illuminate\Routing\Exceptions\StreamedResponseException.

func (*StreamedResponseError) Error

func (e *StreamedResponseError) Error() string

func (*StreamedResponseError) GetInnerException

func (e *StreamedResponseError) GetInnerException() error

GetInnerException is StreamedResponseException::getInnerException. It returns the error raised while the body was already being written, which is the one that says what actually went wrong.

func (*StreamedResponseError) Render

Render is StreamedResponseException::render. The response has already begun, so there is nothing left to say: PHP answers an empty 200 body and so does this. It writes nothing and reports whether the header could still be sent.

func (*StreamedResponseError) Unwrap

func (e *StreamedResponseError) Unwrap() error

type URLGenerationError

type URLGenerationError struct {
	// Route is the name of the route the URL was being built for.
	Route string
	// URI is the pattern of that route, so the message shows which
	// placeholders exist next to the ones that were not filled.
	URI string
	// Parameters are the placeholders left unfilled.
	Parameters []string
}

URLGenerationError is returned when a route URL cannot be built because one or more required parameters are missing.

It mirrors Illuminate\Routing\Exceptions\UrlGenerationException.

func ForMissingParameters

func ForMissingParameters(route GeneratedRoute, parameters ...string) *URLGenerationError

ForMissingParameters is UrlGenerationException::forMissingParameters.

It is the error a named URL raises when the caller gave fewer parameters than the pattern has placeholders -- which is the failure Routes.Route exists to turn into a message instead of a 404 the reader sees.

func (*URLGenerationError) Error

func (e *URLGenerationError) Error() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL