Patchwork [2,of,9,V6] bookmarks: introduce BookmarksEncodeError

login
register
mail settings
Submitter Stanislau Hlebik
Date Oct. 11, 2016, 4:25 p.m.
Message ID <91ae660eb2faf74cb96e.1476203144@dev1918.lla1.facebook.com>
Download mbox | patch
Permalink /patch/17034/
State Changes Requested
Headers show

Comments

Stanislau Hlebik - Oct. 11, 2016, 4:25 p.m.
# HG changeset patch
# User Stanislau Hlebik <stash@fb.com>
# Date 1476195835 25200
#      Tue Oct 11 07:23:55 2016 -0700
# Node ID 91ae660eb2faf74cb96ee7ee5bdcc1f2507f9cf7
# Parent  55e997127023d7208488c593adb933a1bfb23312
bookmarks: introduce BookmarksEncodeError

Binary encoding for bookmarks will be added in next diffs.
This error will be thrown if there are problems with bookmarks encoding.
Pierre-Yves David - Oct. 13, 2016, 4:16 p.m.
On 10/11/2016 06:25 PM, Stanislau Hlebik wrote:
> # HG changeset patch
> # User Stanislau Hlebik <stash@fb.com>
> # Date 1476195835 25200
> #      Tue Oct 11 07:23:55 2016 -0700
> # Node ID 91ae660eb2faf74cb96ee7ee5bdcc1f2507f9cf7
> # Parent  55e997127023d7208488c593adb933a1bfb23312
> bookmarks: introduce BookmarksEncodeError
>
> Binary encoding for bookmarks will be added in next diffs.
> This error will be thrown if there are problems with bookmarks encoding.

Other code I can find about encoding/decoding use ValueError in case of 
trouble. We can probably stick to that for now.

We don't usually introduce very specialized exception unless they have a 
very specialized purpose. From looking at the rest of the series I do 
not see anything special about there usage (but I might have missed 
something).

Cheers

Patch

diff --git a/mercurial/error.py b/mercurial/error.py
--- a/mercurial/error.py
+++ b/mercurial/error.py
@@ -243,3 +243,7 @@ 
 
 class CorruptedState(Exception):
     """error raised when a command is not able to read its state from file"""
+
+class BookmarksEncodeError(Exception):
+    """Raised if bookmarks can't be encoded
+    """