pass common API error text through to Potlatch so it can be shown to the user
This commit is contained in:
parent
3cc3ff7ad6
commit
9b4271ed8c
3 changed files with 25 additions and 9 deletions
16
lib/osm.rb
16
lib/osm.rb
|
@ -13,6 +13,10 @@ module OSM
|
|||
def render_opts
|
||||
{ :text => "Generic API Error", :status => :internal_server_error, :content_type => "text/plain" }
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Generic API Error"
|
||||
end
|
||||
end
|
||||
|
||||
# Raised when an API object is not found.
|
||||
|
@ -31,6 +35,10 @@ module OSM
|
|||
def render_opts
|
||||
{ :text => "Precondition failed: #{@message}", :status => :precondition_failed, :content_type => "text/plain" }
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Precondition failed: #{@message}"
|
||||
end
|
||||
end
|
||||
|
||||
# Raised when to delete an already-deleted object.
|
||||
|
@ -65,6 +73,10 @@ module OSM
|
|||
def render_opts
|
||||
{ :text => "You need to supply a changeset to be able to make a change", :status => :conflict, :content_type => "text/plain" }
|
||||
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
|
||||
|
@ -119,6 +131,10 @@ module OSM
|
|||
", server had: " + latest.to_s + " of " + type + " " + id.to_s,
|
||||
:status => :conflict, :content_type => "text/plain" }
|
||||
end
|
||||
|
||||
def to_s
|
||||
"Version mismatch: Provided " + provided.to_s + ", server had: " + latest.to_s + " of " + type + " " + id.to_s
|
||||
end
|
||||
end
|
||||
|
||||
# raised when a two tags have a duplicate key string in an element.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue