Coursemology/coursemology2

View on GitHub
app/controllers/concerns/application_components_concern.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true
module ApplicationComponentsConcern
  extend ActiveSupport::Concern

  included do
    rescue_from ComponentNotFoundError, with: :handle_component_not_found
  end

  protected

  def handle_component_not_found(exception)
    @exception = exception
    render json: { error: 'Component not found' }, status: :not_found
  end
end