Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrNotFound = errors.New("record not found")
Functions ¶
This section is empty.
Types ¶
type ErrorBody ¶
type ErrorBody struct {
// Message contains the string representation of an error.
Message string `json:"message"`
}
ErrorBody is the encoding for an error message.
type ErrorResponse ¶
type ErrorResponse struct {
// Error holds the error value
Err error `json:"-"`
// StatusCode holds the http response code.
StatusCode int `json:"-"`
// Status is the readable http message of StatusCode.
Status string `json:"status"`
// Error holds the encoded error message.
Error ErrorBody `json:"error,omitempty"`
}
ErrorResponse renderer type for errors.
func InternalServerError ¶
func InternalServerError(err error) *ErrorResponse
func NewErrorResponse ¶
func NewErrorResponse(code int, err error) *ErrorResponse
NewErrorResponse produces a filled ErrorResponse object.
func NotFoundError ¶
func NotFoundError(err error) *ErrorResponse
func (*ErrorResponse) Render ¶
func (e *ErrorResponse) Render(w http.ResponseWriter, r *http.Request) error
Render is a hook to print status code in header.
func (*ErrorResponse) WithError ¶
func (e *ErrorResponse) WithError(err error) *ErrorResponse
Error sets the error message and returns a new ErrorResponse.
type HistoryRecord ¶
type HistoryResponse ¶
type HistoryResponse struct {
Files []string
History map[string][]HistoryRecord
}
func NewHistoryResponse ¶
func NewHistoryResponse() *HistoryResponse
type TaskInfo ¶
type TaskInfo struct {
Task string // Task holds the task name, e.g. `lint`.
Description string // Description holds the task description.
// Flags holds some flags
Flags TaskFlags
// History holds history data
History []HistoryRecord `json:",omitempty"`
}
TaskInfo holds information available about a task, without coupling to taskfile structures too much. We need a subset of data available for the UI, we can still use the rest internally.
This is also the point where exposing vars and cmds becomes a security issue. We still assume that users may want to run it in less trusted environments, in which case we explicitly don't want any information about the contents of the taskfile beyond the target names and descriptions.
func NewTaskInfo ¶
NewTaskInfo converts the taskfile record into our own.