app/controllers/anoubis/core/application_controller.rb
##
# Gracefully terminate script execution with code 422 (Unprocessable entity). And JSON data
# @param data [Hash] Resulting data
# @option data [Integer] :code resulting error code
# @option data [String] :error resulting error message
Gracefully terminate script execution with code 422 (Unprocessable entity). And JSON data
Gracefully terminate script execution with code 422 ( Unprocessable entity ) . And JSON data
def error_exit(data)
    result = {
      result: -1,
      message: 'Error'
    }
    result[:result] = data[:code] if data.has_key? :code
    result[:message] = data[:error] if data.has_key? :error
    respond_to do |format|
      format.json { render json: result, status: :unprocessable_entity }
    end
    begin
      exit
    rescue SystemExit => e
    end
  end
def error_exit ( data ) result = { result : - 1 , message : 'Error' } result [ :result ] = data [ :code ] if data . has_key? :code result [ :message ] = data [ :error ] if data . has_key? :error respond_to do | format | format . json { render json : result , status : :unprocessable_entity } end begin exit rescue SystemExit => e end end
Gracefully terminate script execution with code 422 (Unprocessable entity).
Gracefully terminate script execution with code 422 ( Unprocessable entity ) .
data
:error resulting error message
: error resulting error message