Class: Facebooker::Errors

Inherits:
Parser
  • Object
show all
Defined in:
lib/facebooker/parser.rb

Overview

:nodoc:

Constant Summary collapse

EXCEPTIONS =
{
  1 	=> Facebooker::Session::UnknownError,
  2 	=> Facebooker::Session::ServiceUnavailable,
  4 	=> Facebooker::Session::MaxRequestsDepleted,
  5 	=> Facebooker::Session::HostNotAllowed,
  100 => Facebooker::Session::MissingOrInvalidParameter,
  101 => Facebooker::Session::InvalidAPIKey,
  102 => Facebooker::Session::SessionExpired,
  103 => Facebooker::Session::CallOutOfOrder,
  104 => Facebooker::Session::IncorrectSignature,
  120 => Facebooker::Session::InvalidAlbumId,
  250 => Facebooker::Session::ExtendedPermissionRequired,
  321 => Facebooker::Session::AlbumIsFull,
  324 => Facebooker::Session::MissingOrInvalidImageFile,
  325 => Facebooker::Session::TooManyUnapprovedPhotosPending,
  330 => Facebooker::Session::TemplateDataMissingRequiredTokens,
  340 => Facebooker::Session::TooManyUserCalls,
  341 => Facebooker::Session::TooManyUserActionCalls,
  342 => Facebooker::Session::InvalidFeedTitleLink,
  343 => Facebooker::Session::InvalidFeedTitleLength,
  344 => Facebooker::Session::InvalidFeedTitleName,
  345 => Facebooker::Session::BlankFeedTitle,
  346 => Facebooker::Session::FeedBodyLengthTooLong,
  347 => Facebooker::Session::InvalidFeedPhotoSource,
  348 => Facebooker::Session::InvalidFeedPhotoLink,      
  330 => Facebooker::Session::FeedMarkupInvalid,
  360 => Facebooker::Session::FeedTitleDataInvalid,
  361 => Facebooker::Session::FeedTitleTemplateInvalid,
  362 => Facebooker::Session::FeedBodyDataInvalid,
  363 => Facebooker::Session::FeedBodyTemplateInvalid,
  364 => Facebooker::Session::FeedPhotosNotRetrieved,
  366 => Facebooker::Session::FeedTargetIdsInvalid,
  601 => Facebooker::Session::FQLParseError,
  602 => Facebooker::Session::FQLFieldDoesNotExist,
  603 => Facebooker::Session::FQLTableDoesNotExist,
  604 => Facebooker::Session::FQLStatementNotIndexable,
  605 => Facebooker::Session::FQLFunctionDoesNotExist,
  606 => Facebooker::Session::FQLWrongNumberArgumentsPassedToFunction,
  807 => Facebooker::Session::TemplateBundleInvalid
}

Constants inherited from Parser

Parser::PARSERS

Class Method Summary collapse

Methods inherited from Parser

anonymous_field_from, array_of, array_of_hashes, array_of_text_values, element, hash_or_value_for, hashinate, parse

Class Method Details

.process(data) ⇒ Object



482
483
484
485
486
487
488
489
# File 'lib/facebooker/parser.rb', line 482

def self.process(data)
  response_element = element('error_response', data) rescue nil
  if response_element
    hash = hashinate(response_element)
    exception = EXCEPTIONS[Integer(hash['error_code'])] || StandardError
    raise exception.new(hash['error_msg'])
  end
end