Use DoesNotExistError rather than CommandError in get_by_qurl
This commit is contained in:
parent
9758b52d91
commit
1781d0fba3
@ -1110,7 +1110,10 @@ class CommandDispatcher:
|
|||||||
quickmark_manager = objreg.get('quickmark-manager')
|
quickmark_manager = objreg.get('quickmark-manager')
|
||||||
if name is None:
|
if name is None:
|
||||||
url = self._current_url()
|
url = self._current_url()
|
||||||
name = quickmark_manager.get_by_qurl(url)
|
try:
|
||||||
|
name = quickmark_manager.get_by_qurl(url)
|
||||||
|
except urlmarks.DoesNotExistError as e:
|
||||||
|
raise cmdexc.CommandError(str(e))
|
||||||
try:
|
try:
|
||||||
quickmark_manager.delete(name)
|
quickmark_manager.delete(name)
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -34,7 +34,7 @@ from PyQt5.QtCore import pyqtSignal, QUrl, QObject
|
|||||||
|
|
||||||
from qutebrowser.utils import (message, usertypes, qtutils, urlutils,
|
from qutebrowser.utils import (message, usertypes, qtutils, urlutils,
|
||||||
standarddir, objreg)
|
standarddir, objreg)
|
||||||
from qutebrowser.commands import cmdexc, cmdutils
|
from qutebrowser.commands import cmdutils
|
||||||
from qutebrowser.misc import lineparser
|
from qutebrowser.misc import lineparser
|
||||||
|
|
||||||
|
|
||||||
@ -218,7 +218,7 @@ class QuickmarkManager(UrlMarkManager):
|
|||||||
index = list(self.marks.values()).index(urlstr)
|
index = list(self.marks.values()).index(urlstr)
|
||||||
key = list(self.marks.keys())[index]
|
key = list(self.marks.keys())[index]
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise cmdexc.CommandError(
|
raise DoesNotExistError(
|
||||||
"Quickmark for '{}' not found!".format(urlstr))
|
"Quickmark for '{}' not found!".format(urlstr))
|
||||||
return key
|
return key
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user