phperr

package
v0.0.0-...-18194de Latest Latest
Warning

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

Go to latest
Published: May 5, 2026 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandledByUser = errors.New("handled by user error handler")

ErrHandledByUser is returned when a user error handler has handled the error. Callers should not display the default error message when this is returned.

Functions

func CatchReturn

func CatchReturn(v *phpv.ZVal, err error) (*phpv.ZVal, error)

func CatchTimeout

func CatchTimeout(err error) error

func HandleUserError

func HandleUserError(ctx phpv.Context, err *phpv.PhpError) error

Types

type GeneratorForceClose

type GeneratorForceClose struct{}

GeneratorForceClose is a sentinel error used to force-close a generator. When injected into a suspended generator goroutine, it causes the generator to unwind through try/finally blocks (running finally code) but is NOT caught by PHP catch blocks. If the generator tries to yield in a finally block while being force-closed, a real PHP Error is thrown.

func (*GeneratorForceClose) Error

func (e *GeneratorForceClose) Error() string

type PhpBreak

type PhpBreak struct {
	L       *phpv.Loc
	Intv    phpv.ZInt
	Initial phpv.ZInt
}

func (*PhpBreak) Dump

func (b *PhpBreak) Dump(w io.Writer) error

func (*PhpBreak) Error

func (b *PhpBreak) Error() string

func (*PhpBreak) Run

func (b *PhpBreak) Run(ctx phpv.Context) (*phpv.ZVal, error)

type PhpContinue

type PhpContinue struct {
	L       *phpv.Loc
	Intv    phpv.ZInt
	Initial phpv.ZInt
}

func (*PhpContinue) Dump

func (c *PhpContinue) Dump(w io.Writer) error

func (*PhpContinue) Error

func (c *PhpContinue) Error() string

func (*PhpContinue) Run

func (c *PhpContinue) Run(ctx phpv.Context) (*phpv.ZVal, error)

type PhpReturn

type PhpReturn struct {
	L *phpv.Loc
	V *phpv.ZVal
}

func (*PhpReturn) Error

func (r *PhpReturn) Error() string

type PhpThrow

type PhpThrow struct {
	Obj phpv.ZObject
	Loc *phpv.Loc
}

func (*PhpThrow) Error

func (e *PhpThrow) Error() string

func (*PhpThrow) ErrorTrace

func (e *PhpThrow) ErrorTrace(ctx phpv.Context) (string, *PhpThrow)

ErrorTrace formats the exception for uncaught-exception output. It calls __toString() on the exception object, which handles the full $previous chain. If __toString() itself throws (e.g. because the message property is a non-stringifiable object), the *new* error is returned as the fatal error string, matching PHP behaviour.

The returned *PhpThrow (if non-nil) indicates that __toString() threw, and the caller should use this replacement exception for file/line info.

func (*PhpThrow) SetLocation

func (e *PhpThrow) SetLocation(file string, line int)

SetLocation overrides the exception's file and line (both on the Loc and on the exception object's properties). Used when an error originates from an internal context like __toString() conversion.

func (*PhpThrow) ThrownFile

func (e *PhpThrow) ThrownFile() string

ThrownFile returns the file where the exception was constructed (from the exception object's "file" property), falling back to Loc.Filename.

func (*PhpThrow) ThrownLine

func (e *PhpThrow) ThrownLine() int

ThrownLine returns the line where the exception was constructed (from the exception object's "line" property), falling back to Loc.Line.

type PhpTimeout

type PhpTimeout struct {
	L       *phpv.Loc
	Seconds int
}

func (*PhpTimeout) Error

func (t *PhpTimeout) Error() string

func (*PhpTimeout) String

func (t *PhpTimeout) String() string

Jump to

Keyboard shortcuts

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