diff --git a/dir2cast.php b/dir2cast.php index 0629a9a..535440e 100644 --- a/dir2cast.php +++ b/dir2cast.php @@ -1195,7 +1195,10 @@ protected function scan() self::$DEBUG && print("$item_count items added.\n"); if(self::$EMPTY_PODCAST_IS_ERROR && 0 == $item_count) - throw new Exception("No Items found in {$this->source_dir}"); + { + http_response_code(404); + throw new Exception("No content yet."); + } $this->calculateItemHash(); @@ -1580,12 +1583,20 @@ public static function display($message, $errfile, $errline) { if(self::$errors) { - if(!defined('CLI_ONLY') && !ini_get('html_errors')) + if(!defined('CLI_ONLY') || !CLI_ONLY) + { + if(!http_response_code()) + { + http_response_code(500); + }q + } + + if((!defined('CLI_ONLY') || !CLI_ONLY) && !ini_get('html_errors')) { header("Content-type: text/plain"); // reset the content-type } - if(!defined('CLI_ONLY') && ini_get('html_errors')) + if((!defined('CLI_ONLY') || !CLI_ONLY ) && ini_get('html_errors')) { header("Content-type: text/html"); // reset the content-type @@ -1605,14 +1616,16 @@ public static function display($message, $errfile, $errline)

An error occurred generating your podcast.

-

+

+ +

+
+ This error occurred on line of . +
-
- This error occurred on line of . -

@@ -1631,15 +1644,15 @@ public static function display($message, $errfile, $errline) echo strip_tags(self::get_primed_error(ErrorHandler::$primer)) . "\n"; } - throw new ExitException("", -1); + exit(-1); // can't throw - this is the exception handler } } public static function display404($message) { - if(defined('CLI_ONLY')) + if(defined('CLI_ONLY') && CLI_ONLY) { - header("HTTP/1.0 404 Not Found"); + http_response_code(404); header("Content-type: text/plain"); } throw new ExitException("Not Found: $message", -2);