Sha256: 802bc9d459d3cde90c09871f2d82ef1461dd926919d22c49f7a705575938dba7
Contents?: true
Size: 1.98 KB
Versions: 5
Compression:
Stored size: 1.98 KB
Contents
# frozen_string_literal: true module Roqua module Healthy class Error < StandardError; end class ConnectionError < Error; end class NACK < Error; end class IllegalMirthResponse < ConnectionError; end class Timeout < ConnectionError; end class HostUnreachable < ConnectionError; end class ConnectionRefused < ConnectionError; end class UnknownFailure < Error; end class PatientIdNotInRemote < Error; end class PatientNotFound < Error; end class AuthenticationFailure < Error; end module MirthErrors class WrongPatient < Error; end end def self.convert_generic_errors_to_healthy_errors yield rescue RestClient::Exceptions::ReadTimeout, RestClient::Exceptions::OpenTimeout => error raise ::Roqua::Healthy::Timeout, error.message rescue ::Timeout::Error => error raise ::Roqua::Healthy::Timeout, error.message rescue Errno::ETIMEDOUT => error raise ::Roqua::Healthy::Timeout, error.message rescue Errno::EHOSTUNREACH => error raise ::Roqua::Healthy::HostUnreachable, error.message rescue Errno::ECONNREFUSED => error raise ::Roqua::Healthy::ConnectionRefused, error.message end ERRORS = { 'Timeout waiting for ACK' => ::Roqua::Healthy::Timeout, "Unable to connect to destination\tSocketTimeoutException\tconnect timed out" => ::Roqua::Healthy::Timeout, 'ERROR: Timeout waiting for response' => ::Roqua::Healthy::Timeout, 'ERROR: SocketTimeoutException: connect timed out' => ::Roqua::Healthy::Timeout, "Unable to connect to destination\tConnectException\tConnection refused" => ::Roqua::Healthy::ConnectionRefused, 'ERROR: ConnectException: Connection refused' => ::Roqua::Healthy::ConnectionRefused, "ERROR: NACK sent from receiver. (Rejected)" => ::Roqua::Healthy::NACK, "ERROR: NACK sent from receiver. (Error)" => # ie. Patient not found ::Roqua::Healthy::NACK }.freeze end end
Version data entries
5 entries across 5 versions & 1 rubygems