You are here

public function FacebookAlbum::translate_error in Facebook Album 8

Translate API errors into a user friendly error.

Parameters

$code: The error code returned from the facebook API or internally

$message: The corresponding message to that error code, if there is one

Return value

string A user friendly error message

Overrides FacebookAlbumInterface::translate_error

File

src/FacebookAlbum.php, line 124
Contains \Drupal\facebook_album\FacebookAlbum.

Class

FacebookAlbum
Facebook Album.

Namespace

Drupal\facebook_album

Code

public function translate_error($code, $message) {
  switch ($code) {
    case 1:
      $message = "Unable to retrieve data from Facebook. This could be due to an invalid Application ID/Application Secret or Facebook is temporarily unreachable.";
      break;
    case 10000:
      $message = "Unable to verify data from Facebook at this time. Please try again.";
      break;
  }
  return $message;
}