From ef0ecf243a4ee25079eb8b2386d0f869047d7877 Mon Sep 17 00:00:00 2001 From: Tobias Diekershoff Date: Sat, 8 Aug 2020 08:47:21 +0200 Subject: [PATCH] fopen error messages --- src/Console/ServerBlock.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/Console/ServerBlock.php b/src/Console/ServerBlock.php index 40d8e45e7..d052612e1 100644 --- a/src/Console/ServerBlock.php +++ b/src/Console/ServerBlock.php @@ -112,6 +112,9 @@ HELP; $filename = $this->getArgument(1); $blocklist = $config->get('system', 'blocklist', []); $fp = fopen($filename, 'w'); + if (!$fp) { + throw new Exception(sprintf('The file "%s" could not be created.', $filename)); + } foreach ($blocklist as $domain) { fputcsv($fp, $domain); } @@ -156,6 +159,8 @@ HELP; return 1; } + } else { + throw new Exception(sprintf('The file "%s" could not be opened for importing', $filename)); } }