Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/gitdb/exc.py: 87%
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
Shortcuts on this page
r m x toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1# Copyright (C) 2010, 2011 Sebastian Thiel (byronimo@gmail.com) and contributors
2#
3# This module is part of GitDB and is released under
4# the New BSD License: https://opensource.org/license/bsd-3-clause/
5"""Module with common exceptions"""
6from gitdb.util import to_hex_sha
8__all__ = [
9 'AmbiguousObjectName',
10 'BadName',
11 'BadObject',
12 'BadObjectType',
13 'InvalidDBRoot',
14 'ODBError',
15 'ParseError',
16 'UnsupportedOperation',
17 'to_hex_sha',
18]
20class ODBError(Exception):
21 """All errors thrown by the object database"""
24class InvalidDBRoot(ODBError):
25 """Thrown if an object database cannot be initialized at the given path"""
28class BadObject(ODBError):
29 """The object with the given SHA does not exist. Instantiate with the
30 failed sha"""
32 def __str__(self):
33 return "BadObject: %s" % to_hex_sha(self.args[0])
36class BadName(ODBError):
37 """A name provided to rev_parse wasn't understood"""
39 def __str__(self):
40 return "Ref '%s' did not resolve to an object" % self.args[0]
43class ParseError(ODBError):
44 """Thrown if the parsing of a file failed due to an invalid format"""
47class AmbiguousObjectName(ODBError):
48 """Thrown if a possibly shortened name does not uniquely represent a single object
49 in the database"""
52class BadObjectType(ODBError):
53 """The object had an unsupported type"""
56class UnsupportedOperation(ODBError):
57 """Thrown if the given operation cannot be supported by the object database"""