15318: Adds X-Request-Id value to every error response. Fixes test.
[arvados.git] / services / api / app / controllers / application_controller.rb
index e07a5aca79b5a310d320c6901df9c5a82326465a..d5bc3f35d7e04fc47f9795f8a3643f4aef8bcf57 100644 (file)
@@ -183,6 +183,9 @@ class ApplicationController < ActionController::Base
       err = {}
     end
     err[:errors] ||= args
+    err[:errors].map! do |err|
+      err += " (" + Thread.current[:request_id] + ")"
+    end
     err[:error_token] = [Time.now.utc.to_i, "%08x" % rand(16 ** 8)].join("+")
     status = err.delete(:status) || 422
     logger.error "Error #{err[:error_token]}: #{status}"