luautil

package
v1.1.8 Latest Latest
Warning

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

Go to latest
Published: May 5, 2021 License: Zlib Imports: 3 Imported by: 21

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ConvNumber

func ConvNumber(s string, integer, float bool) (valid, iok bool, i int64, f float64)

ConvNumber converts a string to a number. This is intended for internal use by various Lua related packages, you should not use this unless you know what you are doing.

func Raise

func Raise(msg string, typ ErrType)

Raise converts a string to a Error and then panics with it.

func RaiseExisting

func RaiseExisting(err error, msg string)

RaiseExisting converts an error to a Error then panics with it.

Types

type ErrType

type ErrType int
const (
	ErrTypUndefined     ErrType = iota // Anything that does not fit a category.
	ErrTypMajorInternal                // Errors that should not happen, ever.

	ErrTypGenLexer // Generic syntax errors caught by the lexer.

	ErrTypGenSyntax  // Generic syntax errors.
	ErrTypGenRuntime // Generic run time errors.

	ErrTypBinLoader // An error encountered while loading a binary chunk.
	ErrTypBinDumper

	ErrTypWrapped // An error from some other library or native API code wrapped into a standard Error.
	ErrTypEvil    // If some idiot panics with a non-error value, it will be wrapped with this type.
)

Error types.

type Error

type Error struct {
	Err  error
	Msg  string
	Type ErrType

	Trace string
}

Error is used for any and every error that is produced by the VM and its peripherals.

func (Error) Error

func (err Error) Error() string

Error formats an Error like so:

<Msg>: <Err.Error()>
  Stack Trace: <Trace>

If any of the three parts are missing they are elided, in the extreme case of an empty error the message will be:

Unspecified error

Jump to

Keyboard shortcuts

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