Skip to content

Commit 0929b25

Browse files
committed
Added more specific debug messages for when fetching a URL fails.
1 parent 1ed68bb commit 0929b25

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

sources/url.source.php

+8
Original file line numberDiff line numberDiff line change
@@ -143,19 +143,27 @@ function do_get($text_file, $conf) {
143143
global $tts_debug;
144144

145145
if (!isset($conf['url']) || empty($conf['url'])) {
146+
$tts_debug->error("Failed to get text from URL: No URL configured");
146147
return false;
147148
}
148149

149150
if (($pos = strpos($conf['url'], ':')) === false) {
151+
$tts_debug->error("Failed to get text from URL: Bad URL configured");
152+
$tts_debug->error_dump("url", $conf['url']);
150153
return false;
151154
}
152155
if (substr($conf['url'], $pos, 3) != '://') {
156+
$tts_debug->error("Failed to get text from URL: Bad URL configured (no <stream>:// found");
157+
$tts_debug->error_dump("url", $conf['url']);
153158
return false;
154159
}
155160

156161
$proto = substr($conf['url'], 0, $pos);
157162
$wrappers = stream_get_wrappers();
158163
if (!in_array($proto, $wrappers)) {
164+
$tts_debug->error("Failed to get text from URL: No stream wrapper for '" . $proto . "' was found");
165+
$tts_debug->error_dump("url", $conf['url']);
166+
$tts_debug->error_dump("wrappers", $wrappers);
159167
return false;
160168
}
161169

0 commit comments

Comments
 (0)