2018-11-12 11:00:41 +00:00
|
|
|
package nginx
|
|
|
|
|
|
|
|
import (
|
|
|
|
"fmt"
|
2018-11-18 21:49:11 +00:00
|
|
|
"git.xdrm.io/go/nix-amer/internal/clifmt"
|
2018-11-12 11:00:41 +00:00
|
|
|
)
|
|
|
|
|
2018-11-12 15:42:24 +00:00
|
|
|
// ErrNullReceiver is raised when a null receiver is provided
|
|
|
|
var ErrNullReceiver = fmt.Errorf("receiver must not be null")
|
|
|
|
|
|
|
|
// ErrInvalidReceiver is raised when an invalid receiver is provided
|
2018-11-12 18:22:24 +00:00
|
|
|
var ErrInvalidReceiver = fmt.Errorf("receiver must be compatible with *Line")
|
2018-11-12 15:42:24 +00:00
|
|
|
|
|
|
|
// ErrUnexpectedSectionClose is raised when reading a section close '}' without an
|
|
|
|
// open section
|
|
|
|
var ErrUnexpectedSectionClose = fmt.Errorf("unexpected section close")
|
|
|
|
|
|
|
|
// ErrUnclosedSection is raised when there is unclosed sections reaching the end
|
|
|
|
// of the file
|
|
|
|
var ErrUnclosedSection = fmt.Errorf("unclosed section")
|
|
|
|
|
|
|
|
// ErrInvalidSyntax is raised when a line cannot be understood
|
|
|
|
var ErrInvalidSyntax = fmt.Errorf("invalid syntax")
|
|
|
|
|
2018-11-12 11:00:41 +00:00
|
|
|
// LineError wraps errors with a line index
|
|
|
|
type LineError struct {
|
|
|
|
Line int
|
|
|
|
Err error
|
|
|
|
}
|
|
|
|
|
|
|
|
// Error implements Error
|
|
|
|
func (le LineError) Error() string {
|
|
|
|
return fmt.Sprintf(":%d %s", le.Line, clifmt.Color(31, le.Err.Error()))
|
|
|
|
}
|