Documentation ¶
Overview ¶
The errs package contains stuff related with errors.
Index ¶
Constants ¶
const ( // statusCodeSuccess indicates a successful execution. StatusCodeSuccess = 0 // statusCodeBadUsage indicates some user error in the usage of the romualdo // tool (e.g., passing the wrong number of arguments, or passing a // nonexisting command-line flag). StatusCodeBadUsage = 3 )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BadUsage ¶
type BadUsage struct { // Message contains a message explaining what happened. Message string }
BadUsage is an error that happened because the romualdo tool was called in the wrong way (like incorrect command-line arguments).
func NewBadUsage ¶
NewBadUsage is a handy way to create a BadUsage error.
type CompileTime ¶
type CompileTime struct { // Message contains a user-friendly error message. Message string // FileName is the name of the file where the error was detected. FileName string // Line contains the line number where the error was detected. Line int // Lexeme contains the lexeme where the error was detected. Lexeme string }
CompileTime is an error used to represent any compile-time error.
func NewCompileTime ¶
func NewCompileTime(fileName string, line int, format string, a ...any) *CompileTime
NewCompileTime is a handy way to create a CompileTime error at some specific line of code.
func NewCompileTimeWithoutLine ¶
func NewCompileTimeWithoutLine(fileName, format string, a ...any) *CompileTime
NewCompileTimeWithoutLine is a handy way to create a CompileTime error that is not related with a specific line of code.
func (*CompileTime) Error ¶
func (e *CompileTime) Error() string
Error converts the CompileTime to a string. Fulfills the error interface.
func (*CompileTime) ExitCode ¶
func (e *CompileTime) ExitCode() int
ExitCode fulfills the Error interface.
type CompileTimeCollection ¶
type CompileTimeCollection struct { // Errors is the collection of CompileTime errors. Errors []*CompileTime }
CompileTimeCollection is a collection of CompileTime errors.
func (*CompileTimeCollection) Add ¶
func (e *CompileTimeCollection) Add(err *CompileTime)
Add adds a new error to the collection of errors. A no-op if err is nil.
func (*CompileTimeCollection) AddMany ¶
func (e *CompileTimeCollection) AddMany(errs *CompileTimeCollection)
AddMany adds all the errors in errs to e.
func (*CompileTimeCollection) Error ¶
func (e *CompileTimeCollection) Error() string
Error converts the CompileTimeCollection to a string -- a multiline string at that, with one error per line. Fulfills the error interface.
func (*CompileTimeCollection) ExitCode ¶
func (e *CompileTimeCollection) ExitCode() int
ExitCode fulfills the Error interface.
func (*CompileTimeCollection) IsEmpty ¶
func (e *CompileTimeCollection) IsEmpty() bool
IsEmpty checks if this CompileTimeCollection is empty (i.e., if it is collection of errors without any errors inside it).
type ICE ¶
type ICE struct { // Message contains some message to contextualize the situation in which the // error happened. Hopefully will be good enough to help fixing the bug. Message string }
ICE is an Internal Compiler Error. Used to report some unexpected issue with the compiler -- like when we find it is on a state it wasn't expected to be. It's always a bug.
type RomualdoTool ¶
type RomualdoTool struct { // Message contains a message explaining what went wrong. Message string }
RomualdoTool is an error that happened when running the romualdo tool that doesn't fit any of the other error types. Could be, e.g., an error opening some file.
func NewRomualdoTool ¶
func NewRomualdoTool(format string, a ...any) *RomualdoTool
NewRomualdoTool is a handy way to create a RomualdoTool error.
func (*RomualdoTool) Error ¶
func (e *RomualdoTool) Error() string
Error converts the RomualdoTool to a string. Fulfills the error interface.
func (*RomualdoTool) ExitCode ¶
func (e *RomualdoTool) ExitCode() int
ExitCode fulfills the Error interface.
type Runtime ¶
type Runtime struct { // Message contains a message explaining what happened. Message string }
Runtime is an error that happened while running a Storyworld. Not sure I am ready to vouch for this, but I think that this if this ever happens, it means there is a bug in the tooling.
func NewRuntime ¶
NewRuntime is a handy way to create a Runtime error.
type TestSuite ¶
type TestSuite struct { // TestCase contains the path to the test case that failed. TestCase string // Message contains a message explaining how the test failed. Message string }
TestSuite is an error that happened when running the Romualdo test suite (i.e.¸when testing Romualdo itself).
func NewTestSuite ¶
NewTestSuite is a handy way to create a TestSuite error.