summaryrefslogtreecommitdiff
path: root/exc.py
blob: 012cdbc6bce4957c5dc8d5e7075c3b0fda703622 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
"""Module with common exceptions"""
from util import to_hex_sha

class ODBError(Exception):
	"""All errors thrown by the object database"""
	
class InvalidDBRoot(ODBError):
	"""Thrown if an object database cannot be initialized at the given path"""
	
class BadObject(ODBError):
	"""The object with the given SHA does not exist. Instantiate with the 
	failed sha"""
	
	def __str__(self):
		return "BadObject: %s" % to_hex_sha(self.args[0])

class AmbiguousObjectName(ODBError):
	"""Thrown if a possibly shortened name does not uniquely represent a single object
	in the database"""

class BadObjectType(ODBError):
	"""The object had an unsupported type"""

class UnsupportedOperation(ODBError):
	"""Thrown if the given operation cannot be supported by the object database"""