class ErrorsController < ApplicationController skip_before_action :verify_authenticity_token def not_found respond_to do |format| format.html { render status: :not_found } format.json { render json: { error: "Resource not found" }, status: :not_found } format.all { render status: :not_found, body: nil } end end def internal_server_error respond_to do |format| format.html { render status: :internal_server_error } format.json { render json: { error: "Internal server error" }, status: :internal_server_error } end end def unprocessable_entity respond_to do |format| format.html { render status: :unprocessable_entity } format.json { render json: { error: "Unprocessable entity" }, status: :unprocessable_entity } end end def too_many_requests respond_to do |format| format.html { render status: :too_many_requests } format.json { render json: { error: "Too many requests" }, status: :too_many_requests } end end end