# File lib/grape/middleware/error.rb, line 79 def format_message(message, backtrace, original_exception = nil) format = env[Grape::Env::API_FORMAT] || options[:format] formatter = Grape::ErrorFormatter.formatter_for(format, options) throw :error, status: 406, message: "The requested format '#{format}' is not supported.", backtrace: backtrace, original_exception: original_exception unless formatter formatter.call(message, backtrace, options, env, original_exception) end