Class: RubberDuck::ErrorsController

Inherits:
ApplicationController show all
Defined in:
app/controllers/rubber_duck/errors_controller.rb

Instance Method Summary collapse

Instance Method Details

#analyze ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
16
# File 'app/controllers/rubber_duck/errors_controller.rb', line 5

def analyze
  unless Rails.env.development?
    return render json: { error: "Only available in development" }, status: :forbidden
  end

  result = AiService.analyze_error(
      exception_message: params[:exception],
      backtrace: params[:backtrace],
      logs: params[:logs]
    )
  render json: result
end