From 137b586de68f198a0c784901b6e0a80d87a8d6a4 Mon Sep 17 00:00:00 2001 From: Guillermo Pages Date: Fri, 1 Jul 2022 11:20:12 +0200 Subject: [PATCH] feat: add better exception message --- src/Utils/DotEnv.php | 2 +- src/Utils/Logger/Logger.php | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/Utils/DotEnv.php b/src/Utils/DotEnv.php index 17d801a..4ffc517 100644 --- a/src/Utils/DotEnv.php +++ b/src/Utils/DotEnv.php @@ -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); diff --git a/src/Utils/Logger/Logger.php b/src/Utils/Logger/Logger.php index 9209209..1dd94b2 100644 --- a/src/Utils/Logger/Logger.php +++ b/src/Utils/Logger/Logger.php @@ -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