+ { :text => "You need to supply a changeset to be able to make a change", :status => :conflict, :content_type => "text/plain" }
+ end
+ end
+
+ # Raised when a diff is uploaded containing many changeset IDs which don't match
+ # the changeset ID that the diff was uploaded to.
+ class APIChangesetMismatchError < APIError
+ def initialize(provided, allowed)
+ @provided, @allowed = provided, allowed
+ end
+
+ def render_opts
+ { :text => "Changeset mismatch: Provided #{@provided} but only " +
+ "#{@allowed} is allowed.", :status => :conflict, :content_type => "text/plain" }
+ end
+ end
+
+ # Raised when a diff upload has an unknown action. You can only have create,
+ # modify, or delete
+ class APIChangesetActionInvalid < APIError
+ def initialize(provided)
+ @provided = provided
+ end
+
+ def render_opts
+ { :text => "Unknown action #{@provided}, choices are create, modify, delete.",
+ :status => :bad_request, :content_type => "text/plain" }
+ end
+ end
+
+ # Raised when bad XML is encountered which stops things parsing as
+ # they should.
+ class APIBadXMLError < APIError
+ def initialize(model, xml, message="")
+ @model, @xml, @message = model, xml, message
+ end
+
+ def render_opts
+ { :text => "Cannot parse valid #{@model} from xml string #{@xml}. #{@message}",
+ :status => :bad_request, :content_type => "text/plain" }