lib/warp/dir/errors.rb in warp-dir-1.6.2 vs lib/warp/dir/errors.rb in warp-dir-1.7.0
- old
+ new
@@ -4,10 +4,11 @@
class Runtime < RuntimeError;
end
class StoreFormatError < Warp::Dir::Errors::Runtime
attr_reader :line
+
def initialize(msg, line)
@line = line
super msg
end
end
@@ -19,10 +20,11 @@
# initializer and assumed to be the reason for the failure.
# Message is optional, but each concrete exception should provide
# it's own concrete message
class InstanceError < Warp::Dir::Errors::Runtime
attr_accessor :instance
+
def initialize(message = nil)
super message ? message : "#{self.class.name}->[#{instance}]"
end
def name
@@ -47,9 +49,10 @@
def initialize(point)
self.instance = point
super color_error('Point ', point.to_s, ' was not found.')
end
end
+
class PointAlreadyExists < ::Warp::Dir::Errors::InstanceError
def initialize(point)
self.instance = point
super color_error('Point ', point.to_s, ' already exists. Pass --force to overwrite.')
end