Using an around_handler for catching and rendering errors in most of the API controller methods. This simplifies the code and makes errors and error messages a bit more consistent. Also added a utility method for checking the HTTP method.

This commit is contained in:
Matt Amos 2009-05-20 17:39:59 +00:00
parent 058d942c7c
commit 3d0ca940d2
13 changed files with 311 additions and 444 deletions

View file

@ -218,11 +218,6 @@ class Relation < ActiveRecord::Base
# in the hash to be overwritten.
raise OSM::APIDuplicateTagsError.new("relation", self.id, k) if @tags.include? k
# check tag size here, as we don't create a RelationTag object until
# just before we save...
raise OSM::APIBadUserInput.new("Relation #{self.id} has a tag with too long a key, '#{k}'.") if k.length > 255
raise OSM::APIBadUserInput.new("Relation #{self.id} has a tag with too long a value, '#{k}'='#{v}'.") if v.length > 255
@tags[k] = v
end