Coverage for /pythoncovmergedfiles/medio/medio/usr/local/lib/python3.8/site-packages/gitdb/exc.py: 86%
14 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:25 +0000
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-07 06:25 +0000
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: http://www.opensource.org/licenses/bsd-license.php
5"""Module with common exceptions"""
6from gitdb.util import to_hex_sha
9class ODBError(Exception):
10 """All errors thrown by the object database"""
13class InvalidDBRoot(ODBError):
14 """Thrown if an object database cannot be initialized at the given path"""
17class BadObject(ODBError):
18 """The object with the given SHA does not exist. Instantiate with the
19 failed sha"""
21 def __str__(self):
22 return "BadObject: %s" % to_hex_sha(self.args[0])
25class BadName(ODBError):
26 """A name provided to rev_parse wasn't understood"""
28 def __str__(self):
29 return "Ref '%s' did not resolve to an object" % self.args[0]
32class ParseError(ODBError):
33 """Thrown if the parsing of a file failed due to an invalid format"""
36class AmbiguousObjectName(ODBError):
37 """Thrown if a possibly shortened name does not uniquely represent a single object
38 in the database"""
41class BadObjectType(ODBError):
42 """The object had an unsupported type"""
45class UnsupportedOperation(ODBError):
46 """Thrown if the given operation cannot be supported by the object database"""