Class: ErrorHandler

Inherits:
RubyPitaya::HandlerBase show all
Defined in:
lib/rubypitaya/app-template/app/handlers/error_handler.rb

Instance Attribute Summary

Attributes inherited from RubyPitaya::HandlerBase

#config, #log, #objects, #params, #postman, #services, #session, #setup

Instance Method Summary collapse

Methods inherited from RubyPitaya::HandlerBase

authenticated_action_name?, #initialize, non_authenticated_actions, objects, #set_attributes

Constructor Details

This class inherits a constructor from RubyPitaya::HandlerBase

Instance Method Details

#getErrorObject



5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rubypitaya/app-template/app/handlers/error_handler.rb', line 5

def getError
  error_code = RubyPitaya::StatusCodes::CODE_ERROR
  error_message = "Some Error"

  raise RubyPitaya::RouteError.new(error_code, error_message)

  response = {
    code: StatusCodes::CODE_OK,
    data: {
      message: 'Ok!'
    }
  }
end