You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: caseflow_errors.rb
    path of file: ./repos/vets-api/lib/common/client/middleware/response
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

module Common
  module Client
    module Middleware
      module Response
        class CaseflowErrors < Faraday::Middleware
      
    
          def on_complete(env)
            return if env.success?

            mapped_error = env[:body]['errors']&.first
            return if mapped_error.nil?

            # Caseflow does not generally populate a "code" so we
            # fall back to using the status as a code.
            env[:body]['code'] = mapped_error['code'] || mapped_error['status']
            env[:body]['detail'] = mapped_error['title']
            env[:body]['source'] = mapped_error['detail']
          end
        end