diff options
author | Arron Woods <aw@chartblocks.com> | 2015-03-05 09:27:50 +0000 |
---|---|---|
committer | Arron Woods <aw@chartblocks.com> | 2015-03-05 09:27:50 +0000 |
commit | da6253e2fad867f79898dca836d869aabc2909e6 (patch) | |
tree | 535531459bcbff5b170c59a586cd186de8bb45df | |
parent | 49f4e1e4ba0a89f2b84adc395c758e7b1bd189b3 (diff) | |
download | php-ssrs-da6253e2fad867f79898dca836d869aabc2909e6.zip php-ssrs-da6253e2fad867f79898dca836d869aabc2909e6.tar.gz php-ssrs-da6253e2fad867f79898dca836d869aabc2909e6.tar.bz2 |
Better error handling for invalid cache path
-rwxr-xr-x | library/SSRS/Soap/NTLM.php | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/library/SSRS/Soap/NTLM.php b/library/SSRS/Soap/NTLM.php index 077c71e..e937470 100755 --- a/library/SSRS/Soap/NTLM.php +++ b/library/SSRS/Soap/NTLM.php @@ -2,6 +2,8 @@ namespace SSRS\Soap; +use RuntimeException; + class NTLM extends \SoapClient { protected $_uri; @@ -73,18 +75,18 @@ class NTLM extends \SoapClient { return $this; } - public function setCachePath($path) { - $folder = dirname($path); - - if (!is_dir($folder)) { - throw new Exception('WSDL cache path is not valid'); - } + public function setCachePath($file) { + $folder = dirname($file); - if (!is_writeable($folder)) { - throw new Exception('WSDL cache path not writeable'); + if (file_exists($file) && false === is_writable($file)) { + throw new RuntimeException("WSDL cache file not writeable"); + } elseif (false === is_dir($folder)) { + throw new RuntimeException("WSDL cache parent folder does not exist"); + } elseif (false === is_writeable($folder)) { + throw new RuntimeException("WSDL cache parent folder not writeable"); } - $this->_cachePath = $path; + $this->_cachePath = $file; return $this; } |