Skip to content

Commit

Permalink
Replace die with throw new exception for unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dmzoneill committed Apr 2, 2018
1 parent 8a9c36a commit ff4c4be
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions php-binance-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ public function setProxy( array $proxyconf ) {
*/
private function httpRequest( string $url, string $method = "GET", array $params = [], bool $signed = false ) {
if( function_exists( 'curl_init' ) == false ) {
die( "Sorry cURL is not installed!" );
throw new \Exception( "Sorry cURL is not installed!" );
}

$ch = curl_init();
Expand All @@ -665,9 +665,9 @@ private function httpRequest( string $url, string $method = "GET", array $params
// signed with params
if( $signed == true ) {
if( empty( $this->api_key ) )
die( "signedRequest error: API Key not set!" );
throw new \Exception( "signedRequest error: API Key not set!" );
if( empty( $this->api_secret ) )
die( "signedRequest error: API Secret not set!" );
throw new \Exception( "signedRequest error: API Secret not set!" );
$base = $this->base;
$ts = ( microtime( true ) * 1000 ) + $this->info[ 'timeOffset' ];
$params[ 'timestamp' ] = number_format( $ts, 0, '.', '' );
Expand Down

0 comments on commit ff4c4be

Please sign in to comment.