Skip to content

Commit

Permalink
Implement cURLMissing exception
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhicks committed Feb 25, 2012
1 parent b0465ba commit 16aa0f0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions application/MantisBT/Exception/Twitter/cURLMissing.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<?php
namespace MantisBT\Exception\Twitter;
use MantisBT\Exception\ExceptionAbstract;

require_api('lang_api.php');

class cURLMissing extends ExceptionAbstract {
public function __construct() {
$errorMessage = lang_get(ERROR_TWITTER_NO_CURL_EXT, null, false);
parent::__construct(ERROR_TWITTER_NO_CURL_EXT, $errorMessage, null);
$this->responseCode = 500;
}
}
4 changes: 3 additions & 1 deletion application/core/twitter_api.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@
* @uses utility_api.php
*/

use MantisBT\Exception\Twitter\cURLMissing;

require_api( 'bug_api.php' );
require_api( 'category_api.php' );
require_api( 'config_api.php' );
Expand Down Expand Up @@ -63,7 +65,7 @@ function twitter_enabled() {
}

if( $g_twitter_enabled && !function_exists( 'curl_init' ) ) {
trigger_error( ERROR_TWITTER_NO_CURL_EXT, ERROR );
throw new cURLMissing();
}

return $g_twitter_enabled;
Expand Down

0 comments on commit 16aa0f0

Please sign in to comment.