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: service.rb
    path of file: ./repos/vets-api/lib/va_profile/military_personnel
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require 'common/client/concerns/monitoring'
require 'common/client/errors'
require 'va_profile/service'
require 'va_profile/stats'
require 'va_pro
    
      def get_service_history
        with_monitoring do
          edipi_present!

          response = perform(:post, identity_path, VAProfile::Models::ServiceHistory.in_json)

          ServiceHistoryResponse.from(@current_user, response)
        end
      rescue Common::Client::Errors::ClientError => e
        error_status = e.status
        if error_status == 404
          log_exception_to_sentry(
            e, { edipi: @user.edipi }, { va_profile: :service_history_not_found }, :warning
          )

          return ServiceHistoryResponse.new(404, episodes: nil)
        elsif error_status && error_status >= 400 && error_status < 500
          return ServiceHistoryResponse.new(error_status, episodes: nil)
        end