Documentation
¶
Index ¶
- func CommandName(cmd *cobra.Command) string
- func EncodeDocument(format Format, value any) ([]byte, error)
- func EncodeRecord(format Format, value any) ([]byte, error)
- func Fail(code Code, message string, cause error) error
- func FailWithDiagnostics(code Code, message string, cause error, diagnostics []diagnostic.Diagnostic) error
- func FormatHelp() string
- func IsReported(err error) bool
- func PrintUnreportedError(cmd *cobra.Command, err error)
- func Reported(err error) error
- func WithFiles(err error, files []filechange.Change) error
- func WriteCommandError(cmd *cobra.Command, format Format, collected []diagnostic.Diagnostic, ...) error
- func WriteDocument(out io.Writer, format Format, value any) error
- func WriteRecord(out io.Writer, format Format, value any) error
- type Code
- type CommandError
- type Failure
- type Format
- type ReportedError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CommandName ¶
func FailWithDiagnostics ¶
func FailWithDiagnostics( code Code, message string, cause error, diagnostics []diagnostic.Diagnostic, ) error
func FormatHelp ¶
func FormatHelp() string
func IsReported ¶
func PrintUnreportedError ¶
func WriteCommandError ¶
func WriteCommandError( cmd *cobra.Command, format Format, collected []diagnostic.Diagnostic, failure error, ) error
Types ¶
type CommandError ¶
type CommandError struct {
Kind string `json:"kind" ub:"kind"`
FormatVersion int `json:"format-version" ub:"format-version"`
Command string `json:"command" ub:"command"`
Code Code `json:"code" ub:"code"`
Message string `json:"message" ub:"message"`
Diagnostics []diagnostic.Diagnostic `json:"diagnostics" ub:"diagnostics"`
Files []filechange.Change `json:"files" ub:"files"`
}
type Failure ¶
type Failure struct {
Code Code
Message string
Cause error
Diagnostics []diagnostic.Diagnostic
Files []filechange.Change
}
type ReportedError ¶
type ReportedError struct {
Err error
}
func (*ReportedError) Error ¶
func (e *ReportedError) Error() string
func (*ReportedError) Unwrap ¶
func (e *ReportedError) Unwrap() error
Click to show internal directories.
Click to hide internal directories.