Error Handling


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_RESOURCE_NOT_LOADED = 4,
  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
}

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.

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_RESOURCE_NOT_LOADED  One or several of the supplied resources is not yet loaded.
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 occured, 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 occured.
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.


Function Documentation

const char* sp_error_message ( sp_error  error  ) 

Convert a numeric libspotify error code to a text string

Parameters:
[in] error The error code to lookup


Generated on Wed Nov 3 12:46:14 2010.
Copyright © 2006–2009 Spotify Ltd