Added errors package
Some checks failed
/ test (push) Failing after 17s

This commit is contained in:
Eduard Urbach 2025-06-19 16:56:30 +02:00
parent 1405d2b8b1
commit ee1b7f4e44
Signed by: akyoto
GPG key ID: 49226B848C78F6C8
4 changed files with 165 additions and 0 deletions

18
src/errors/New.go Normal file
View file

@ -0,0 +1,18 @@
package errors
import (
"git.urbach.dev/cli/q/src/fs"
"git.urbach.dev/cli/q/src/token"
)
// New generates an error message at the current token position.
// The error message is clickable in popular editors and leads you
// directly to the faulty file at the given line and position.
func New(err error, file *fs.File, position token.Position) *FileError {
return &FileError{
err: err,
file: file,
position: position,
stack: stack(),
}
}