commonerrors

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2022 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ErrorWithSource

type ErrorWithSource struct {

	// SourceCodeString is the input source code string for the error.
	SourceCodeString string

	// LineNumber is the (1-indexed) line number of the error, or 0 if unknown.
	LineNumber uint64

	// ColumnPosition is the (1-indexed) column position of the error, or 0 if
	// unknown.
	ColumnPosition uint64
	// contains filtered or unexported fields
}

ErrorWithSource is an error that includes the source text and position information.

func AsErrorWithSource

func AsErrorWithSource(err error) (*ErrorWithSource, bool)

AsErrorWithSource returns the error as an ErrorWithSource, if applicable.

func NewErrorWithSource

func NewErrorWithSource(err error, sourceCodeString string, oneIndexedLineNumber uint64, oneIndexedColumnPosition uint64) *ErrorWithSource

NewErrorWithSource creates and returns a new ErrorWithSource.

func (*ErrorWithSource) InnerError

func (ews *ErrorWithSource) InnerError() error

InnerError returns the inner, wrapped error.

type SourcePosition

type SourcePosition struct {
	// LineNumber is the 1-indexed line number in the input source.
	LineNumber int

	// ColumnPosition is the 1-indexed column position in the input source.
	ColumnPosition int
}

SourcePosition is a position in the input source.

Jump to

Keyboard shortcuts

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