Skip to content

Commit 78dfbe2

Browse files
committed
Merge pull request PHPIDS#27 from jayzeng/refactor/exception_message
* Exposes log file name in exception message
2 parents 9d98d97 + 8f9bc8e commit 78dfbe2

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

lib/IDS/Log/FileLogger.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,8 @@ protected function prepareData($data)
172172
*
173173
* @param object $data IDS_Report
174174
*
175-
* @throws Exception if the logfile isn't writeable
175+
* @throws Exception if the logfile isn't writeable
176+
* @throws InvalidArgumentException if the logfile doesn't exist
176177
* @return boolean
177178
*/
178179
public function execute(Report $data)
@@ -198,17 +199,17 @@ public function execute(Report $data)
198199

199200
} else {
200201
throw new \Exception(
201-
'Please make sure that ' . $this->logfile .
202-
' is writeable.'
203-
);
202+
'Please make sure that ' . $this->logfile .
203+
' is writeable.'
204+
);
204205
}
205206
}
206-
} else {
207-
throw new \Exception(
208-
'Given file does not exist. Please make sure the
209-
logfile is present in the given directory.'
210-
);
211207
}
208+
209+
throw new \InvalidArgumentException(
210+
sprintf('Given file %s does not exist. Please make sure the logfile is present in the given directory.',
211+
$this->logfile)
212+
);
212213
} else {
213214
throw new \Exception(
214215
'Please make sure that data returned by

0 commit comments

Comments
 (0)