/usr/lib/python2.7/dist-packages/chef/exceptions.py is in python-chef 0.2.3-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
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 26 27 28 29 30 31 | # Exception hierarchy for chef
# Copyright (c) 2010 Noah Kantrowitz <noah@coderanger.net>
class ChefError(Exception):
"""Top-level Chef error."""
class ChefServerError(ChefError):
"""An error from a Chef server. May include a HTTP response code."""
def __init__(self, message, code=None):
self.raw_message = message
if isinstance(message, list):
message = u', '.join(m for m in message if m)
super(ChefError, self).__init__(message)
self.code = code
@staticmethod
def from_error(message, code=None):
cls = {
404: ChefServerNotFoundError,
}.get(code, ChefServerError)
return cls(message, code)
class ChefServerNotFoundError(ChefServerError):
"""A 404 Not Found server error."""
class ChefAPIVersionError(ChefError):
"""An incompatible API version error"""
|