feat: add better exception message
This commit is contained in:
@@ -5,7 +5,7 @@ class DotEnv {
|
||||
|
||||
public static function loadFromFile($filepath) {
|
||||
if (!file_exists($filepath)) {
|
||||
throw new \Exception('Cannot find file');
|
||||
throw new \Exception("Cannot find file: $filepath");
|
||||
}
|
||||
$contents = file_get_contents($filepath);
|
||||
$lines = explode(PHP_EOL, $contents);
|
||||
|
||||
@@ -37,12 +37,12 @@ class Logger {
|
||||
|
||||
/**
|
||||
* 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)
|
||||
*
|
||||
*
|
||||
* If $data param contains some of the keys in the right hand array:
|
||||
* 'ip', 'date', ..., 'error', then the $data will prevail
|
||||
*
|
||||
*
|
||||
* @param array $data
|
||||
* @return void
|
||||
*/
|
||||
@@ -80,9 +80,9 @@ class Logger {
|
||||
|
||||
/**
|
||||
* 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 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
|
||||
*
|
||||
* @param any $info
|
||||
@@ -117,7 +117,7 @@ class Logger {
|
||||
|
||||
/**
|
||||
* 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
|
||||
* @return string saved log message filepath
|
||||
|
||||
Reference in New Issue
Block a user