Class: Observability::GroupO11ySettingsUpdateService

Inherits:
Object
  • Object
show all
Defined in:
app/services/observability/group_o11y_settings_update_service.rb

Instance Method Summary collapse

Instance Method Details

#execute(settings, settings_params) ⇒ Object



5
6
7
8
9
10
11
12
13
14
15
# File 'app/services/observability/group_o11y_settings_update_service.rb', line 5

def execute(settings, settings_params)
  if settings.update(manage_params(settings_params))
    ServiceResponse.success(payload: { settings: settings })
  else
    ServiceResponse.error(message: settings.errors.full_messages.join(', '))
  end
rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotFound => e
  ServiceResponse.error(message: e.message)
rescue StandardError => e
  ServiceResponse.error(message: "An unexpected error occurred: #{e.message}")
end