Moonshark/core/routers/Errors.go
2025-04-08 21:26:52 -05:00

26 lines
623 B
Go

package routers
import "errors"
var (
// ErrRoutesCompilationErrors indicates that some routes failed to compile
// but the router is still operational
ErrRoutesCompilationErrors = errors.New("some routes failed to compile")
)
// RouteError represents an error with a specific route
type RouteError struct {
Path string // The URL path
Method string // HTTP method
ScriptPath string // Path to the Lua script
Err error // The actual error
}
// Error returns the error message
func (re *RouteError) Error() string {
if re.Err == nil {
return "unknown route error"
}
return re.Err.Error()
}