From d685af74ce6431e1299f62f16a2d3c8b68dba88c Mon Sep 17 00:00:00 2001 From: ArthurHoaro Date: Thu, 4 Apr 2013 18:50:02 +0200 Subject: [PATCH] fixes #3 That's actually how civilized people handle errors. --- 0.3/functions.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/0.3/functions.php b/0.3/functions.php index 8073e9d..2aacef1 100755 --- a/0.3/functions.php +++ b/0.3/functions.php @@ -22,14 +22,14 @@ function DetectRedirect($url) { if(parse_url($url, PHP_URL_HOST)==FALSE) { //die('Not a URL'); - return array( 'error' => 'Not a URL: '. escape ($url) ); + throw new Exception('Not a URL: '. escape ($url) ); } $response = get_headers($url, 1); if(!empty($response['Location'])) { $response2 = get_headers($response['Location'], 1); if(!empty($response2['Location'])) { //die('too much redirection'); - return array( 'error' => 'too much redirection: '. escape ($url) ); + throw new Exception('too much redirection: '. escape ($url) ); } else { return $response['Location']; } }