1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65
|
package gotify
import (
"errors"
)
// Service/Initialization errors.
var (
// ErrServiceNotInitialized indicates that the service has not been initialized.
ErrServiceNotInitialized = errors.New("service not initialized")
)
// Input validation errors.
var (
// ErrInvalidToken indicates an invalid Gotify token format or content.
ErrInvalidToken = errors.New("invalid gotify token")
// ErrEmptyMessage indicates that the message to send is empty.
ErrEmptyMessage = errors.New("message cannot be empty")
// ErrInvalidPriority indicates that the priority value is outside the valid range.
ErrInvalidPriority = errors.New("priority must be between -2 and 10")
// ErrInvalidDate indicates that the date format is invalid.
ErrInvalidDate = errors.New("invalid date format")
// ErrExtrasUnmarshalFailed indicates failure to unmarshal extras JSON.
ErrExtrasUnmarshalFailed = errors.New("failed to unmarshal extras JSON")
// ErrExtrasParseFailed indicates failure to parse extras JSON from URL query.
ErrExtrasParseFailed = errors.New("failed to parse extras JSON from URL query")
)
// HTTP/Communication errors.
var (
// ErrUnexpectedStatus indicates an unexpected HTTP response status.
ErrUnexpectedStatus = errors.New("got unexpected HTTP status")
// ErrSendFailed indicates failure to send notification to Gotify.
ErrSendFailed = errors.New("failed to send notification to Gotify")
// ErrMarshalRequest indicates failure to marshal request.
ErrMarshalRequest = errors.New("failed to marshal request")
// ErrCreateRequest indicates failure to create HTTP request.
ErrCreateRequest = errors.New("failed to create HTTP request")
// ErrSendRequest indicates failure to send HTTP request.
ErrSendRequest = errors.New("failed to send HTTP request")
// ErrReadResponse indicates failure to read HTTP response.
ErrReadResponse = errors.New("failed to read HTTP response")
// ErrParseResponse indicates failure to parse HTTP response.
ErrParseResponse = errors.New("failed to parse HTTP response")
)
// Configuration errors.
var (
// ErrConfigUpdateFailed indicates failure to update configuration.
ErrConfigUpdateFailed = errors.New("failed to update configuration")
// ErrConfigPropertyFailed indicates failure with a configuration property.
ErrConfigPropertyFailed = errors.New("failed to set configuration property")
)
|