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