serrors

package
v0.0.0-...-87c4152 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Overview

serrors contains error types used by the server

Index

Constants

This section is empty.

Variables

View Source
var ErrUnitNotFoundWithoutFetch = &ServerError{
	Status: http.StatusNotFound,
	Epage: &page.ErrorPage{
		MessageTemplate: template.MakeTrustedTemplate(`
					    <h3 class="Error-message">{{.StatusText}}</h3>
					    <p class="Error-message">Check that you entered the URL correctly or try fetching it following the
                        <a href="/about#adding-a-package">instructions here</a>.</p>`),
		MessageData: struct{ StatusText string }{http.StatusText(http.StatusNotFound)},
	},
}

errUnitNotFoundWithoutFetch returns a 404 with instructions to the user on how to manually fetch the package. No fetch button is provided. This is used for very large modules or modules that previously 500ed.

Functions

func DatasourceNotSupportedError

func DatasourceNotSupportedError() error

func InvalidVersionError

func InvalidVersionError(fullPath, requestedVersion string) error

Types

type ServerError

type ServerError struct {
	Status       int    // HTTP status code
	ResponseText string // Response text to the user
	Epage        *page.ErrorPage
	Err          error // wrapped error
}

ServerError is a type of error that can be dosplayed by the server.

func (*ServerError) Error

func (s *ServerError) Error() string

func (*ServerError) Unwrap

func (s *ServerError) Unwrap() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL