Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var As = errors.As
As is equavalent to errors.As
var Errorf = fmt.Errorf
Errorf is equavalent to fmt.Errorf
var New = errors.New
New is equavalent to errors.New
var Separator = ":\n\t"
Separator is the string used to separate nested errors. By default, to make errors easier on the eye, nested errors are indented on a new line. A server may instead choose to keep each error on a single line by modifying the separator string, perhaps to ":: ".
Functions ¶
func E ¶
E builds an error value from its arguments. There must be at least one argument or E panics. The type of each argument determines its meaning. If more than one argument of a given type is presented, only the last one is recorded.
The types are:
radio.SongID: The song identifier of the song involved radio.TrackID: The track identifier of the song involved radio.Song, radio.QueueEntry: The song involved, fills in both SongID and TrackID above errors.Delay: The delay until this error is resolved errors.Info: Extra info useful to this class of error, think argument name when using InvalidArgument errors.Op: The operation being performed string: Treated as an error message and assigned to the Err field after a call to errors.New errors.Kind: The class of error error: The underlying error that triggered this one
If the error is printed, only those items that have been set to non-zero values will appear in the result.
If Kind is not specified or Other, we set it to the Kind of the underlying error.
Types ¶
type Delay ¶
Delay is the amount of time still left on a cooldown
func SelectDelay ¶
SelectDelay returns the first non-zero Delay found in the error given, if none is found ok will be false
type Error ¶
type Error struct { Kind Kind Op Op SongID radio.SongID TrackID radio.TrackID Delay Delay Info Info Err error }
Error is the type that implements the error interface. It contains a number of fields, each of different type. An Error value may leave some values unset.
type Kind ¶
type Kind uint8
Kind defines the kind of error this is
const ( Other Kind = iota // Unclassified error InvalidArgument // Invalid argument given to function SongUnknown // Song does not exist SongWithoutTrack // Song did not have required track fields SongUnusable // Song is not playable by streamer SongCooldown // Song is on request cooldown UserCooldown // User is on request cooldown UserUnknown // User does not exist StreamerNotRunning // Streamer isn't running StreamerRunning // Streamer is already running StreamerAlreadyStopped // Streamer is already stopping StreamerNoRequests // Streamer requests are disabled QueueEmpty // Queue is empty QueueExhausted // Queue has no more songs QueueShort // Queue is short songs SearchIndexExists // Search index already exists SearchNoResults // Search had no results BrokenTopic // IRC channel topic broken TransactionBegin // Database begin transaction failure TransactionRollback // Database rollback transaction failure TransactionCommit // Database commit transaction failure ProviderUnknown // Unknown service provider name used NotImplemented // Generic error indicating something is not implemented NewsUnknown // News post does not exist SessionUnknown // Session does not exist InvalidForm // Form submitted was invalid InternalServer // InternalServer error, these return 501 AccessDenied // Someone tried to access something they're not allowed to NoRelays // No relays were found in the DB. TemplateUnknown // Template does not exist TemplateParseError // Template failed to parse Testing // For testing purposes NoMigrations // indicates there were no storage migrations DirtyMigration // indicates the migration failed to apply and is in a dirty state MigrationNotApplied // indicates not all migrations were applied LoginError // Login error SubmissionUnknown // Submission does not exist Spam // Comment is spam Duplicate // Duplicate where one isn't allowed )
Kinds of errors
Do not reorder this list or remove items; New items must be added only to the end