apperror

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrSomethingWentWrong is when an unexpected error occurred.
	ErrSomethingWentWrong = NewError(http.StatusInternalServerError, `something_went_wrong`)

	// ErrPageElementsCannotBeGreaterThan100 must not be less than 100.
	ErrPageElementsCannotBeGreaterThan100 = NewError(http.StatusBadRequest, `elements_must_be_less_than_100`)

	// ErrOrderByDirectionUnexpectedValue is when an unexpected direction is specified.
	ErrOrderByDirectionUnexpectedValue = NewError(http.StatusBadRequest, `order_by_direction_unexpected_value`)
)
View Source
var (
	ErrFilterIDsMustBeGreaterThan0               = ErrMustBeGreaterThan(`filter_ids`, 0)
	ErrFilterGenreIDsMustBeGreaterThan0          = ErrMustBeGreaterThan(`filter_genre_ids`, 0)
	ErrFilterStudioIDsMustBeGreaterThan0         = ErrMustBeGreaterThan(`filter_studio_ids`, 0)
	ErrFilterFormatMustBeGreaterThan0            = ErrMustBeGreaterThan(`filter_format`, 0)
	ErrFilterSeasonMustBeGreaterThan0            = ErrMustBeGreaterThan(`filter_season`, 0)
	ErrFilterStatusMustBeGreaterThan0            = ErrMustBeGreaterThan(`filter_status`, 0)
	ErrFilterSeasonYearMustBeGreaterThan0        = ErrMustBeGreaterThan(`filter_season`, 0)
	ErrFilterNextAiringDateGteMustBeGreaterThan0 = ErrMustBeGreaterThan(`filter_next_airing_date_gte`, 0)
	ErrFilterNextAiringDateLteMustBeGreaterThan0 = ErrMustBeGreaterThan(`filter_next_airing_date_lte`, 0)

	ErrFilterEitherIDorTitle        = NewError(http.StatusBadRequest, `filter_either_id_or_title`)
	ErrFilterTitleSpecifiedButEmpty = NewError(http.StatusBadRequest, `filter_title_specified_but_empty`)
	ErrFilterOrderByUnexpectedValue = NewError(http.StatusBadRequest, `filter_orderby_unexpected_value`)
	ErrFilterUnexpectedParse        = NewError(http.StatusBadRequest, `filter_unexpected_body`)
)
View Source
var (
	ErrJobTaskNotFound        = NewError(http.StatusNotFound, `job_task_not_found`)
	ErrJobTaskAlreadyRunning  = NewError(http.StatusBadRequest, `job_task_already_running`)
	ErrJobTaskAlreadyDisabled = NewError(http.StatusBadRequest, `job_task_already_disabled`)
	ErrJobTaskNotRunning      = NewError(http.StatusBadRequest, `job_task_not_running`)
	ErrJobTaskIsNotDisabled   = NewError(http.StatusBadRequest, `job_task_is_not_disabled`)
	ErrJobTaskIsDisabled      = NewError(http.StatusBadRequest, `job_task_is_disabled`)
)
View Source
var (
	ErrLibraryTitleMissing               = NewError(http.StatusBadRequest, `library_title_missing`)
	ErrLibraryAnimeIDGreaterThan0        = NewError(http.StatusBadRequest, `library_anime_id_must_be_greater_than_0`)
	ErrLibraryExpectedDeletedAtOrAnimeID = NewError(http.StatusBadRequest, `library_expected_deleted_at_or_anime_id`)
)
View Source
var (
	ErrIdentifierMustBeNumeric  = NewError(http.StatusBadRequest, `id_must_be_numeric`)
	ErrWrongContextDataType     = NewError(http.StatusInternalServerError, `wrong_context_data_type`)
	ErrExpectedCharButGotString = NewError(http.StatusBadRequest, `expected_char_but_got_string`)
	ErrRecordNotFound           = NewError(http.StatusNotFound, `record_not_found`)
	ErrEpisodeNameRequired      = NewError(http.StatusBadRequest, `episode_name_is_required`)
	ErrUnchangedValue           = NewError(http.StatusBadRequest, `unchanged_value`)
)
View Source
var (
	ErrPreferencesAnimeIDIsRequired = NewError(http.StatusBadRequest, `preferences_anime_id_is_required`)

	ErrPreferencesUnexpectedPayload = NewError(http.StatusBadRequest, `preferences_unexpected_payload`)
)
View Source
var (
	// ErrPubSubAlreadySubbedToTopic is when a client is already subscribed to a topic.
	ErrPubSubAlreadySubbedToTopic = NewError(http.StatusBadRequest, `pubsub_already_subbed_to_topic`)
	// ErrPubSubNotSubbedToTopic is when a client is not subscribed to a topic.
	ErrPubSubNotSubbedToTopic = NewError(http.StatusBadRequest, `pubsub_not_subbed_to_topic`)
	// ErrPubSubTopicNotFound is when we attempt subscribe to a non-existant topic.
	ErrPubSubTopicNotFound = NewError(http.StatusNotFound, `pubsub_topic_not_found`)
)
View Source
var (
	ErrRunnerIdentRequired      = NewError(http.StatusBadRequest, `runner_ident_is_required`)
	ErrRunnerNotFound           = NewError(http.StatusNotFound, `runner_not_found`)
	ErrRunnerIsNotConnected     = NewError(http.StatusConflict, `runner_is_not_connected`)
	ErrRunnerTransferIsNotOwned = NewError(http.StatusFailedDependency, `runner_transfer_is_not_owned`)
)
View Source
var (
	ErrThirdPartyIntegrationError    = NewError(http.StatusFailedDependency, `third_party_integration`)
	ErrThirdPartyAnimeDoesNotExist   = NewError(http.StatusNotFound, `third_party_anime_does_not_exist`)
	ErrThirdPartyExpectedOneOfTheIds = NewError(http.StatusBadRequest, `third_party_expected_either_one_of_the_ids`)
)
View Source
var (
	ErrTitleIDMissing                       = NewError(http.StatusBadRequest, `title_id_missing`)
	ErrTitleMustNotBeReviewedBeforeDeletion = NewError(http.StatusBadRequest, `title_must_be_reviewed_before_delete`)
	ErrTitleExpectedOneOfTheIds             = NewError(http.StatusBadRequest, `title_expected_either_one_of_the_ids`)
	ErrTitleNotFound                        = NewError(http.StatusNotFound, `title_not_found`)
)
View Source
var (
	ErrVideoPathRequired = NewError(http.StatusBadRequest, `video_path_is_required`)
	ErrVideoDoesNotExist = NewError(http.StatusNotFound, `video_does_not_exist`)
)
View Source
var ErrAnimeDoesNotExist = NewError(http.StatusNotFound, `anime_does_not_exist`)

Functions

func ErrExpectedStatusCodeOkButGot

func ErrExpectedStatusCodeOkButGot(statusCode int) error

ErrExpectedStatusCodeOkButGot is a helper method for when the status code is not 2xx.

func ErrMustBeGreaterThan

func ErrMustBeGreaterThan(prefix string, than int) error

ErrMustBeGreaterThan is a helper method for when the `prefix` is now greater than `than`.

func ErrTitleNotFoundWith

func ErrTitleNotFoundWith(
	name string,
	seasonNumber *string,
	year *int,
) error

func NewError

func NewError(code int, key string, errors ...error) error

Types

type Error

type Error struct {
	// contains filtered or unexported fields
}

Error is defined globally amongst other internal packages. It's made up of a code, key and an inner exception. Use .Unwrap() to retrieve the inner exception.

func (*Error) Code

func (e *Error) Code() int

func (*Error) Error

func (e *Error) Error() string

func (*Error) Is

func (e *Error) Is(err error) bool

func (*Error) Uwnrap

func (e *Error) Uwnrap() error

Jump to

Keyboard shortcuts

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