From c8996dcb3b42508845459977d172ae3540f55fe2 Mon Sep 17 00:00:00 2001 From: Vincent Biret Date: Mon, 5 Feb 2024 11:09:02 -0500 Subject: [PATCH] - adds support to deduplicate mapping in the request adapter Signed-off-by: Vincent Biret --- CHANGELOG.md | 6 ++++++ lib/microsoft_kiota_faraday/faraday_request_adapter.rb | 1 + lib/microsoft_kiota_faraday/version.rb | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8ce9180..190c0be 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Changed +## [0.13.0] - 2024-02-05 + +### Changed + +- Added support for error mapping deduplication to reduce generated code. [#20](https://github.com/microsoft/kiota-http-ruby/issues/20) + ## [0.12.0] - 2023-03-28 ### Changed diff --git a/lib/microsoft_kiota_faraday/faraday_request_adapter.rb b/lib/microsoft_kiota_faraday/faraday_request_adapter.rb index 4d18970..f002965 100644 --- a/lib/microsoft_kiota_faraday/faraday_request_adapter.rb +++ b/lib/microsoft_kiota_faraday/faraday_request_adapter.rb @@ -83,6 +83,7 @@ def throw_if_failed_reponse(response, errors_mapping) error_factory = errors_mapping[status_code] unless errors_mapping.nil? error_factory = errors_mapping['4XX'] unless !error_factory.nil? || errors_mapping.nil? || status_code > 500 error_factory = errors_mapping['5XX'] unless !error_factory.nil? || errors_mapping.nil? || status_code < 500 || status_code > 600 + error_factory = errors_mapping['XXX'] unless !error_factory.nil? || errors_mapping.nil? || status_code < 400 || status_code > 600 raise MicrosoftKiotaAbstractions::ApiError, 'The server returned an unexpected status code and no error factory is registered for this code:' + status_code.to_s if error_factory.nil? root_node = self.get_root_parse_node(response) error = root_node.get_object_value(error_factory) unless root_node.nil? diff --git a/lib/microsoft_kiota_faraday/version.rb b/lib/microsoft_kiota_faraday/version.rb index 558751c..8a11635 100644 --- a/lib/microsoft_kiota_faraday/version.rb +++ b/lib/microsoft_kiota_faraday/version.rb @@ -1,5 +1,5 @@ # frozen_string_literal: true module MicrosoftKiotaFaraday - VERSION = '0.12.0' + VERSION = '0.13.0' end