lib/rack/linkeddata/conneg.rb in rack-linkeddata-0.1.1 vs lib/rack/linkeddata/conneg.rb in rack-linkeddata-0.1.2

- old
+ new

@@ -49,14 +49,18 @@ # @param [Integer] status # @param [Hash{String => Object}] headers # @param [RDF::Enumerable] body # @return [Array(Integer, Hash, #each)] def serialize(env, status, headers, body) - writer, content_type = find_writer(env) - if writer - headers = headers.merge(VARY).merge('Content-Type' => content_type) # FIXME: don't overwrite existing Vary headers - [status, headers, [writer.dump(body)]] - else + begin + writer, content_type = find_writer(env) + if writer + headers = headers.merge(VARY).merge('Content-Type' => content_type) # FIXME: don't overwrite existing Vary headers + [status, headers, [writer.dump(body)]] + else + not_acceptable + end + rescue RDF::WriterError => e not_acceptable end end ##