Added env value validation on CLI level as well.

This commit is contained in:
Abdulmhsen B. A. A
2024-05-15 17:46:36 +03:00
parent c4a8e72164
commit 0d71ae64c0
2 changed files with 99 additions and 1 deletions

View File

@@ -133,7 +133,10 @@ final class Env
throw new InvalidArgumentException(r("Invalid value for '{key}'.", ['key' => $key]));
}
} catch (InvalidArgumentException $e) {
return api_error($e->getMessage(), HTTP_STATUS::HTTP_BAD_REQUEST);
return api_error(r("Value validation for '{key}' failed. {error}", [
'key' => $key,
'error' => $e->getMessage()
]), HTTP_STATUS::HTTP_BAD_REQUEST);
}
$this->envFile->set($key, $value)->persist();