Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 3.1.1 (Next)

* [#581](https://github.com/slack-ruby/slack-ruby-client/pull/581): Migrate Danger to use danger-pr-comment workflow - [@dblock](https://github.com/dblock).
* [#583](https://github.com/slack-ruby/slack-ruby-client/pull/583): Not found errors raised by id_for use more specific error classes when they exist - [@eizengan](https://github.com/eizengan).
* Your contribution here.

### 3.1.0 (2025/11/15)
Expand Down
4 changes: 3 additions & 1 deletion lib/slack/web/api/mixins/ids.id.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@ def id_for(key:, name:, prefix:, enum_method:, list_method:, options: {})
end
end

raise Slack::Web::Api::Errors::SlackError, "#{key}_not_found"
error_message = "#{key}_not_found"
error_class = Slack::Web::Api::Errors::ERROR_CLASSES[error_message] || Slack::Web::Api::Errors::SlackError
raise error_class, error_message
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion spec/slack/web/api/mixins/conversations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@

it 'fails with an exception' do
expect { conversations.conversations_id(channel: '#invalid') }.to(
raise_error(Slack::Web::Api::Errors::SlackError, 'channel_not_found')
raise_error(Slack::Web::Api::Errors::ChannelNotFound, 'channel_not_found')
)
end

Expand Down
2 changes: 1 addition & 1 deletion spec/slack/web/api/mixins/users_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

it 'fails with an exception' do
expect { users.users_id(user: '@foo') }.to(
raise_error(Slack::Web::Api::Errors::SlackError, 'user_not_found')
raise_error(Slack::Web::Api::Errors::UserNotFound, 'user_not_found')
)
end

Expand Down
Loading