errors

package
v0.0.0-...-e62627f Latest Latest
Warning

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

Go to latest
Published: Aug 31, 2026 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package errors creates Node-style JavaScript Error objects for QuickJS.

Index

Constants

View Source
const (
	ErrCodeInvalidArgType  = "ERR_INVALID_ARG_TYPE"
	ErrCodeInvalidArgValue = "ERR_INVALID_ARG_VALUE"
	ErrCodeMissingArgs     = "ERR_MISSING_ARGS"
	ErrCodeOutOfRange      = "ERR_OUT_OF_RANGE"
	ErrCodeInvalidThis     = "ERR_INVALID_THIS"
	ErrCodeUnknownEncoding = "ERR_UNKNOWN_ENCODING"
	ErrCodeInvalidURL      = "ERR_INVALID_URL"
	ErrCodeInvalidTuple    = "ERR_INVALID_TUPLE"
	ErrCodeNotImplemented  = "ERR_NOT_IMPLEMENTED"
)

Variables

This section is empty.

Functions

func NewArgumentOutOfRangeError

func NewArgumentOutOfRangeError(ctx *quickjs.Context, name string, value any) *quickjs.Value

NewArgumentOutOfRangeError creates ERR_OUT_OF_RANGE for a named argument.

func NewError

func NewError(ctx *quickjs.Context, ctor *quickjs.Value, code string, format string, args ...any) *quickjs.Value

NewError creates an Error instance using ctor when non-nil, or Error otherwise. The returned value is owned by the caller.

func NewNotCorrectTypeError

func NewNotCorrectTypeError(ctx *quickjs.Context, name, expected string) *quickjs.Value

NewNotCorrectTypeError creates ERR_INVALID_ARG_TYPE for a named argument.

func NewRangeError

func NewRangeError(ctx *quickjs.Context, code string, format string, args ...any) *quickjs.Value

NewRangeError creates a RangeError with an optional Node error code.

func NewTypeError

func NewTypeError(ctx *quickjs.Context, code string, format string, args ...any) *quickjs.Value

NewTypeError creates a TypeError with an optional Node error code.

func ThrowError

func ThrowError(ctx *quickjs.Context, ctor *quickjs.Value, code string, format string, args ...any) *quickjs.Value

ThrowError throws an Error object and returns QuickJS's exception sentinel.

func ThrowRangeError

func ThrowRangeError(ctx *quickjs.Context, code string, format string, args ...any) *quickjs.Value

ThrowRangeError throws a RangeError with an optional Node error code.

func ThrowTypeError

func ThrowTypeError(ctx *quickjs.Context, code string, format string, args ...any) *quickjs.Value

ThrowTypeError throws a TypeError with an optional Node error code.

Types

type Code

type Code = string

Code is a Node-compatible error code.

Jump to

Keyboard shortcuts

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