+ def status
+ :conflict
+ end
+
+ def to_s
+ "You need to supply a changeset to be able to make a change"
+ 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 status
+ :conflict
+ end
+
+ def to_s
+ "Changeset mismatch: Provided #{@provided} but only #{@allowed} is allowed"
+ 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 status
+ :bad_request
+ end
+
+ def to_s
+ "Unknown action #{@provided}, choices are create, modify, delete"
+ 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 status
+ :bad_request
+ end
+
+ def to_s
+ "Cannot parse valid #{@model} from xml string #{@xml}. #{@message}"