feat: add better exception message

This commit is contained in:
Guillermo Pages
2022-07-01 11:20:12 +02:00
parent aeec3e36d1
commit 858a85954d
2 changed files with 7 additions and 7 deletions

View File

@@ -5,7 +5,7 @@ class DotEnv {
public static function loadFromFile($filepath) { public static function loadFromFile($filepath) {
if (!file_exists($filepath)) { if (!file_exists($filepath)) {
throw new \Exception('Cannot find file'); throw new \Exception("Cannot find file: $filepath");
} }
$contents = file_get_contents($filepath); $contents = file_get_contents($filepath);
$lines = explode(PHP_EOL, $contents); $lines = explode(PHP_EOL, $contents);

View File

@@ -37,12 +37,12 @@ class Logger {
/** /**
* Initialize the start property with microtime in float format * Initialize the start property with microtime in float format
* Initialize self::$data array with a union from argument $data * Initialize self::$data array with a union from argument $data
* and some initial values array : ip, date and some default (none) * and some initial values array : ip, date and some default (none)
* *
* If $data param contains some of the keys in the right hand array: * If $data param contains some of the keys in the right hand array:
* 'ip', 'date', ..., 'error', then the $data will prevail * 'ip', 'date', ..., 'error', then the $data will prevail
* *
* @param array $data * @param array $data
* @return void * @return void
*/ */
@@ -80,9 +80,9 @@ class Logger {
/** /**
* If $key is passed, creates/overwrites existing self::$data[$key] with $info * If $key is passed, creates/overwrites existing self::$data[$key] with $info
* Otherwise, uses array_merge: * Otherwise, uses array_merge:
* if $info has same string keys as self::$data, $info overwrites * if $info has same string keys as self::$data, $info overwrites
* if $info has same integer keys as self::$data, $info keys are renumbered * if $info has same integer keys as self::$data, $info keys are renumbered
* and appended to self::$data * and appended to self::$data
* *
* @param any $info * @param any $info
@@ -117,7 +117,7 @@ class Logger {
/** /**
* Allow stopping by overriding some self::$data values with $data param * Allow stopping by overriding some self::$data values with $data param
* - store the time lapse between start() and stop() calls in self::$data * - store the time lapse between start() and stop() calls in self::$data
* *
* @param $data allow storing some info on stop * @param $data allow storing some info on stop
* @return string saved log message filepath * @return string saved log message filepath