Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

templates: Provide proper error message if entrypoint is not defined.

Aman Agrawal09572fe09b1c
diff --git a/zerver/lib/templates.py b/zerver/lib/templates.py
index d2f3ca7a95a..edd4560d859 100644
--- a/zerver/lib/templates.py
+++ b/zerver/lib/templates.py
@@ -192,8 +192,15 @@ def webpack_entry(entrypoint: str) -> List[str]:
if status != "done":
raise RuntimeError("Webpack compilation was not successful")
- return [
- staticfiles_storage.url(settings.WEBPACK_BUNDLES + filename)
- for filename in stats["chunks"][entrypoint]
- if filename.endswith((".css", ".js")) and not filename.endswith(".hot-update.js")
- ]
+ try:
+ files_from_entrypoints = [
+ staticfiles_storage.url(settings.WEBPACK_BUNDLES + filename)
+ for filename in stats["chunks"][entrypoint]
+ if filename.endswith((".css", ".js")) and not filename.endswith(".hot-update.js")
+ ]
+ except KeyError:
+ raise KeyError(
+ f"'{entrypoint}' entrypoint could not be found. Please define it in tools/webpack.assets.json."
+ )
+
+ return files_from_entrypoints