Skip to content

Commit 861177d

Browse files
committed
restrict: check more specific exception types for str_to_restrict()
1 parent 46eaf27 commit 861177d

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/pkgcraft/restrict.pyx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
from . cimport pkgcraft_c as C
22
from .atom cimport Atom, Cpv
33
from .pkg cimport Pkg
4-
from .error import InvalidRestrict, PkgcraftError
4+
from .error import InvalidCpv, InvalidAtom, InvalidRestrict, PkgcraftError
55

66

77
cdef C.Restrict *str_to_restrict(str s) except NULL:
@@ -10,12 +10,12 @@ cdef C.Restrict *str_to_restrict(str s) except NULL:
1010

1111
try:
1212
return C.pkgcraft_atom_restrict(Cpv(s)._atom)
13-
except PkgcraftError:
13+
except InvalidCpv:
1414
pass
1515

1616
try:
1717
return C.pkgcraft_atom_restrict(Atom(s)._atom)
18-
except PkgcraftError:
18+
except InvalidAtom:
1919
pass
2020

2121
restrict_bytes = s.encode()

0 commit comments

Comments
 (0)