Skip to content

Commit dd62e99

Browse files
committed
Better exception messages.
1 parent 9a7fc9a commit dd62e99

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/HTMLServerComponentsCompiler.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public function process($content, $options = [])
104104
if (substr($sourceParts[1], 0, 7) === 'base64,') {
105105
return $this->process(base64_decode(substr($sourceParts[1], 7)), isset($componentOptions) ? $componentOptions : $options);
106106
}
107-
throw new \Exception('Data URI scheme only supports base64!' . (string) $component);
107+
throw new \Exception('Components data URI scheme only supports base64 (data:base64,ABCD...)!');
108108
} elseif ($scheme === 'file') {
109109
return $this->process($getComponentFileContent(urldecode($sourceParts[1]), $component, isset($options['variables']) && is_array($options['variables']) ? $options['variables'] : []), isset($componentOptions) ? $componentOptions : $options);
110110
}
111-
throw new \Exception('URI scheme not valid!' . (string) $component);
111+
throw new \Exception('Components URI scheme not valid! It must be \'file:\', \'data:\' or an alias.');
112112
}
113-
throw new \Exception('URI scheme not found!' . (string) $component);
113+
throw new \Exception('Components URI scheme or alias not found at ' . (string) $component . '!');
114114
}
115-
throw new \Exception('Component src attribute missing! ' . (string) $component);
115+
throw new \Exception('Component src attribute is missing at ' . (string) $component . '!');
116116
};
117117

118118
$domDocument = new \IvoPetkov\HTML5DOMDocument();

0 commit comments

Comments
 (0)