class ApplicationController < ActionController::Metal
  ActionController::API.without_modules(:ForceSSL, :UrlFor).each do |left|
    include left
  end
  include RailsParam::Param

  rescue_from Mime::Type::InvalidMimeType, with: :rescue_mime_type
  rescue_from StandardError, with: :rescue_all
  include TokenValidate
  

  def rescue_all(e)
    ErrorLog.error(e)
    render json: { code: 500, message: '抱歉~ 系统出错了,攻城狮们已经在修理了!', error: e.class.name.underscore, original_message: e.message  }
  end
  
  def rescue_mime_type(e)
    ErrorLog.error(e)
  end
end