Skip to content

Commit a5be9f7

Browse files
authored
Merge pull request #1288 from Shopify/fix_deprecated-error-not-having-message
Fix FeatureDeprecatedError being raised without a message
2 parents c8d6f16 + 0eca540 commit a5be9f7

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
44

55
## Unreleased
66

7+
- [#1288](https://github.com/Shopify/shopify-api-ruby/pull/1288) Fix FeatureDeprecatedError being raised without a message.
8+
79
## 14.0.0
810
- [#1274](https://github.com/Shopify/shopify-api-ruby/pull/1274) ⚠️ [Breaking] Update sorbet and rbi dependencies. Remove support for ruby 2.7. Minimum required Ruby version is 3.0
911
- [#1282](https://github.com/Shopify/shopify-api-ruby/pull/1282) Fixes a bug where diffing attributes to update not take into account of Array changes and required ids.

lib/shopify_api/logger.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def error(message)
3333
def deprecated(message, version)
3434
return unless enabled_for_log_level?(:warn)
3535

36-
raise Errors::FeatureDeprecatedError unless valid_version(version)
36+
raise Errors::FeatureDeprecatedError, message unless valid_version(version)
3737

3838
send_to_logger(:warn, message)
3939
end

test/logger_test.rb

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,11 @@ class LoggerTest < Minitest::Test
88
def test_deprecated_should_raise_an_error_if_version_is_lower_or_equal_to_current
99
ShopifyAPI::Context.stubs(:log_level).returns(:warn)
1010

11-
assert_raises(ShopifyAPI::Errors::FeatureDeprecatedError) do
11+
error = assert_raises(ShopifyAPI::Errors::FeatureDeprecatedError) do
1212
ShopifyAPI::Logger.deprecated("deprecated feature", ShopifyAPI::VERSION)
1313
end
14+
15+
assert_equal("deprecated feature", error.message)
1416
end
1517

1618
def test_logging_with_log_levels

0 commit comments

Comments
 (0)