Exception: LambdaErrors::LambdaError

Inherits:
StandardError
  • Object
show all
Defined in:
lib/aws_lambda_ric/lambda_errors.rb

Instance Method Summary collapse

Constructor Details

#initialize(original_error, classification = 'Function') ⇒ LambdaError

Returns a new instance of LambdaError.



10
11
12
13
14
15
16
# File 'lib/aws_lambda_ric/lambda_errors.rb', line 10

def initialize(original_error, classification = 'Function')
  @error_class = original_error.class.to_s
  @error_type = "#{classification}<#{original_error.class}>"
  @error_message = original_error.message
  @stack_trace = _sanitize_stacktrace(original_error.backtrace_locations)
  super(original_error)
end

Instance Method Details

#runtime_error_typeObject



18
19
20
21
22
23
24
# File 'lib/aws_lambda_ric/lambda_errors.rb', line 18

def runtime_error_type
  if _allowed_error?
    @error_type
  else
    'Function<UserException>'
  end
end

#to_lambda_responseObject



26
27
28
29
30
31
32
# File 'lib/aws_lambda_ric/lambda_errors.rb', line 26

def to_lambda_response
  {
      :errorMessage => @error_message,
      :errorType => @error_type,
      :stackTrace => @stack_trace
  }
end