You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

error_handler.rb 659 B

​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
​
1234567891011121314151617181920212223242526
  1. #coding=utf-8
  2. module Mobile
  3. module Middleware
  4. class ErrorHandler < Grape::Middleware::Base
  5. def call!(env)
  6. @env = env
  7. begin
  8. @app.call(@env)
  9. rescue =>e
  10. code = 1
  11. message = {status: code, message: e.message }.to_json
  12. Rails.logger.error e.inspect
  13. Rails.logger.error e.backtrace.join("\n")
  14. status = 200
  15. headers = { 'Content-Type' => content_type }
  16. Rack::Response.new([message], status, headers).finish
  17. # throw :error, :message => e.message || options[:default_message], :status => 500
  18. end
  19. end
  20. end
  21. end
  22. end

软件技术创新是当今国家整体创新能力的重要基础和发展引擎。近年来,大众参与的软件创新与创业活动已经成为网络时代软件开发和应用的新形态,正在快速改变着全球软件创新模式和软件产业格局。 ...