lib/chef-dk/exceptions.rb in chef-dk-0.2.1 vs lib/chef-dk/exceptions.rb in chef-dk-0.3.0
- old
+ new
@@ -15,10 +15,44 @@
# limitations under the License.
#
module ChefDK
+ # Base class for errors raised by ChefDK::PolicyfileServices objects. Don't
+ # raise this directly, create a descriptively-named subclass. You can rescue
+ # this to catch all errors from PolicyfileServices objects though.
+ class PolicyfileServiceError < StandardError
+ end
+
+ class PolicyfileNotFound < PolicyfileServiceError
+ end
+
+ class LockfileNotFound < PolicyfileServiceError
+ end
+
+ class PolicyfileInstallError < PolicyfileServiceError
+
+ attr_reader :cause
+
+ def initialize(message, cause)
+ super(message)
+ @cause = cause
+ end
+
+ end
+
+ class PolicyfilePushError < PolicyfileServiceError
+
+ attr_reader :cause
+
+ def initialize(message, cause)
+ super(message)
+ @cause = cause
+ end
+
+ end
+
class CachedCookbookNotFound < StandardError
end
class LocalCookbookNotFound < StandardError
end
@@ -56,6 +90,10 @@
class PolicyfileError < StandardError
end
class MissingCookbookLockData < StandardError
end
+
+ class InvalidLockfile < StandardError
+ end
+
end