lib/restpack_service/service.rb in restpack_service-0.0.3 vs lib/restpack_service/service.rb in restpack_service-0.0.5

- old
+ new

@@ -9,22 +9,24 @@ init mutation = super if mutation.errors mutation.errors.message.each do |error| - @response.errors << Error.new(error[0], error[1].gsub(error[0].capitalize, '')) + @response.add_error(error[0], error[1].gsub(error[0].capitalize, '')) end @response.status ||= :unprocessable_entity else - @response.status ||= :success + @response.status ||= :ok end - if @response.status == :success - @response.result = mutation.result + if @response.status == :ok + @response.result = mutation.result if mutation.result end - rescue - @response.errors << Error.new(:base, 'Service Error') + rescue Exception => e + p e.message #TODO: GJ: logging + + @response.add_error(:base, 'Service Error') @response.status = :internal_service_error end @response end