mercurial/ui.py
changeset 46828 395cf404e76a
parent 46827 1ecf082386b7
child 46906 33524c46a092
--- a/mercurial/ui.py	Tue Mar 23 23:55:33 2021 +0100
+++ b/mercurial/ui.py	Wed Mar 24 00:04:58 2021 +0100
@@ -2339,7 +2339,12 @@
     def chain_path(self, ui, paths):
         if self.url.scheme == b'path':
             assert self.url.path is None
-            subpath = paths[self.url.host]
+            try:
+                subpath = paths[self.url.host]
+            except KeyError:
+                m = _('cannot use `%s`, "%s" is not a known path')
+                m %= (self.rawloc, self.url.host)
+                raise error.Abort(m)
             if subpath.raw_url.scheme == b'path':
                 m = _('cannot use `%s`, "%s" is also define as a `path://`')
                 m %= (self.rawloc, self.url.host)