Permalink
Browse files

Consolidate errors

Consolidate separate error files into errors.rb

Test plan:
- Unit tests pass

Change-Id: I54d6853dbc5033c1ae7578c36854dd0ff781d00a
  • Loading branch information...
mpage
mpage committed Oct 24, 2011
1 parent 1ef58a4 commit 3a58232f321e64574f597a6a7e7f5402190b8459
@@ -1,11 +1,10 @@
require 'vcap/stager/constants'
require 'vcap/stager/config'
+require 'vcap/stager/errors'
require 'vcap/stager/plugin_action_proxy'
require 'vcap/stager/plugin_runner'
-require 'vcap/stager/plugin_runner_error'
require 'vcap/stager/plugin_registry'
require 'vcap/stager/task'
-require 'vcap/stager/task_error'
require 'vcap/stager/task_logger'
require 'vcap/stager/task_manager'
require 'vcap/stager/server'
@@ -1,15 +1,13 @@
-require 'yajl'
-
-require 'vcap/json_schema'
-
module VCAP
module Stager
+ # Root of exception class hierarchy
+ class Error < StandardError; end
# A TaskError is a recoverable error that indicates any further task
# processing should be aborted and the task should be completed in a failed
# state. All other errors thrown during VCAP::Stager::Task#perform will be
# logged and re-raised (probably causing the program to crash).
- class TaskError < StandardError
+ class TaskError < Error
class << self
attr_reader :desc
@@ -28,13 +26,18 @@ def to_s
@details ? "#{self.class.desc}:\n #{@details}" : self.class.desc
end
end
-
class AppDownloadError < TaskError; set_desc "Failed downloading application from the Cloud Controller"; end
class AppUnzipError < TaskError; set_desc "Failed unzipping application"; end
class StagingPluginError < TaskError; set_desc "Staging plugin failed staging application"; end
class StagingTimeoutError < TaskError; set_desc "Staging operation timed out"; end
class DropletCreationError < TaskError; set_desc "Failed creating droplet"; end
class DropletUploadError < TaskError; set_desc "Failed uploading droplet to the Cloud Controller"; end
class InternalError < TaskError; set_desc "Unexpected internal error encountered (possibly a bug)."; end
+
+ # A PluginRunnerError occurs while the application is being staged inside of the container
+ class PluginRunnerError < Error; end
+ class MissingFrameworkPluginError < PluginRunnerError; end
+ class DuplicateFrameworkPluginError < PluginRunnerError; end
+ class UnknownPluginTypeError < PluginRunnerError; end
end
end
@@ -1,12 +1,12 @@
require 'fileutils'
-require 'rubygems'
require 'vcap/cloud_controller/ipc'
require 'vcap/logging'
+
require 'vcap/stager/constants'
+require 'vcap/stager/errors'
require 'vcap/stager/droplet'
require 'vcap/stager/plugin_action_proxy'
-require 'vcap/stager/plugin_runner_error'
require 'vcap/stager/plugin_registry'
module VCAP
@@ -1,8 +0,0 @@
-module VCAP
- module Stager
- class PluginRunnerError < StandardError; end
- class MissingFrameworkPluginError < PluginRunnerError; end
- class DuplicateFrameworkPluginError < PluginRunnerError; end
- class UnknownPluginTypeError < PluginRunnerError; end
- end
-end
@@ -10,7 +10,7 @@
require 'vcap/staging/plugin/common'
require 'vcap/stager/constants'
-require 'vcap/stager/task_error'
+require 'vcap/stager/errors'
module VCAP
module Stager
@@ -2,7 +2,7 @@
require 'rest_client'
require 'uri'
-require 'vcap/stager/task_error'
+require 'vcap/stager/errors'
module VCAP

0 comments on commit 3a58232

Please sign in to comment.