Typedefs | Enumerations | Functions

Error Handling

Typedefs

typedef enum sp_error sp_error

Enumerations

enum  sp_error {
  SP_ERROR_OK = 0,
  SP_ERROR_BAD_API_VERSION = 1,
  SP_ERROR_API_INITIALIZATION_FAILED = 2,
  SP_ERROR_TRACK_NOT_PLAYABLE = 3,
  SP_ERROR_BAD_APPLICATION_KEY = 5,
  SP_ERROR_BAD_USERNAME_OR_PASSWORD = 6,
  SP_ERROR_USER_BANNED = 7,
  SP_ERROR_UNABLE_TO_CONTACT_SERVER = 8,
  SP_ERROR_CLIENT_TOO_OLD = 9,
  SP_ERROR_OTHER_PERMANENT = 10,
  SP_ERROR_BAD_USER_AGENT = 11,
  SP_ERROR_MISSING_CALLBACK = 12,
  SP_ERROR_INVALID_INDATA = 13,
  SP_ERROR_INDEX_OUT_OF_RANGE = 14,
  SP_ERROR_USER_NEEDS_PREMIUM = 15,
  SP_ERROR_OTHER_TRANSIENT = 16,
  SP_ERROR_IS_LOADING = 17,
  SP_ERROR_NO_STREAM_AVAILABLE = 18,
  SP_ERROR_PERMISSION_DENIED = 19,
  SP_ERROR_INBOX_IS_FULL = 20,
  SP_ERROR_NO_CACHE = 21,
  SP_ERROR_NO_SUCH_USER = 22,
  SP_ERROR_NO_CREDENTIALS = 23,
  SP_ERROR_NETWORK_DISABLED = 24,
  SP_ERROR_INVALID_DEVICE_ID = 25,
  SP_ERROR_CANT_OPEN_TRACE_FILE = 26,
  SP_ERROR_APPLICATION_BANNED = 27,
  SP_ERROR_OFFLINE_TOO_MANY_TRACKS = 31,
  SP_ERROR_OFFLINE_DISK_CACHE = 32,
  SP_ERROR_OFFLINE_EXPIRED = 33,
  SP_ERROR_OFFLINE_NOT_ALLOWED = 34,
  SP_ERROR_OFFLINE_LICENSE_LOST = 35,
  SP_ERROR_OFFLINE_LICENSE_ERROR = 36,
  SP_ERROR_LASTFM_AUTH_ERROR = 39,
  SP_ERROR_INVALID_ARGUMENT = 40,
  SP_ERROR_SYSTEM_FAILURE = 41
}

Functions

const char * sp_error_message (sp_error error)

Detailed Description

All functions in libspotify use the same set of error codes. Most of them return an error code, and let the result of the operation be stored in an out-parameter.


Typedef Documentation

typedef enum sp_error sp_error

Error codes returned by various functions


Enumeration Type Documentation

enum sp_error

Error codes returned by various functions

Enumerator:
SP_ERROR_OK 

No errors encountered.

SP_ERROR_BAD_API_VERSION 

The library version targeted does not match the one you claim you support.

SP_ERROR_API_INITIALIZATION_FAILED 

Initialization of library failed - are cache locations etc. valid?

SP_ERROR_TRACK_NOT_PLAYABLE 

The track specified for playing cannot be played.

SP_ERROR_BAD_APPLICATION_KEY 

The application key is invalid.

SP_ERROR_BAD_USERNAME_OR_PASSWORD 

Login failed because of bad username and/or password.

SP_ERROR_USER_BANNED 

The specified username is banned.

SP_ERROR_UNABLE_TO_CONTACT_SERVER 

Cannot connect to the Spotify backend system.

SP_ERROR_CLIENT_TOO_OLD 

Client is too old, library will need to be updated.

SP_ERROR_OTHER_PERMANENT 

Some other error occurred, and it is permanent (e.g. trying to relogin will not help).

SP_ERROR_BAD_USER_AGENT 

The user agent string is invalid or too long.

SP_ERROR_MISSING_CALLBACK 

No valid callback registered to handle events.

SP_ERROR_INVALID_INDATA 

Input data was either missing or invalid.

SP_ERROR_INDEX_OUT_OF_RANGE 

Index out of range.

SP_ERROR_USER_NEEDS_PREMIUM 

The specified user needs a premium account.

SP_ERROR_OTHER_TRANSIENT 

A transient error occurred.

SP_ERROR_IS_LOADING 

The resource is currently loading.

SP_ERROR_NO_STREAM_AVAILABLE 

Could not find any suitable stream to play.

SP_ERROR_PERMISSION_DENIED 

Requested operation is not allowed.

SP_ERROR_INBOX_IS_FULL 

Target inbox is full.

SP_ERROR_NO_CACHE 

Cache is not enabled.

SP_ERROR_NO_SUCH_USER 

Requested user does not exist.

SP_ERROR_NO_CREDENTIALS 

No credentials are stored.

SP_ERROR_NETWORK_DISABLED 

Network disabled.

SP_ERROR_INVALID_DEVICE_ID 

Invalid device ID.

SP_ERROR_CANT_OPEN_TRACE_FILE 

Unable to open trace file.

SP_ERROR_APPLICATION_BANNED 

This application is no longer allowed to use the Spotify service.

SP_ERROR_OFFLINE_TOO_MANY_TRACKS 

Reached the device limit for number of tracks to download.

SP_ERROR_OFFLINE_DISK_CACHE 

Disk cache is full so no more tracks can be downloaded to offline mode.

SP_ERROR_OFFLINE_EXPIRED 

Offline key has expired, the user needs to go online again.

SP_ERROR_OFFLINE_NOT_ALLOWED 

This user is not allowed to use offline mode.

SP_ERROR_OFFLINE_LICENSE_LOST 

The license for this device has been lost. Most likely because the user used offline on three other device.

SP_ERROR_OFFLINE_LICENSE_ERROR 

The Spotify license server does not respond correctly.

SP_ERROR_LASTFM_AUTH_ERROR 

A LastFM scrobble authentication error has occurred.

SP_ERROR_INVALID_ARGUMENT 

An invalid argument was specified.

SP_ERROR_SYSTEM_FAILURE 

An operating system error.


Function Documentation

const char* sp_error_message ( sp_error  error  ) 

Convert a numeric libspotify error code to a text string. The error message is in English. This function is useful for logging purposes.

Parameters:
[in] error The error code to lookup
Examples:
browse.c, jukebox.c, and search.c.

Generated on Wed Jun 13 2012 14:22:40.
Copyright © 2006–2012 Spotify Ltd