Skip to content

Commit 4f92e9b

Browse files
committed
Re-added common errors.
1 parent fa54d20 commit 4f92e9b

File tree

3 files changed

+39
-3
lines changed

3 files changed

+39
-3
lines changed

.rubocop_todo.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# This configuration was generated by
22
# `rubocop --auto-gen-config`
3-
# on 2025-09-21 15:55:34 UTC using RuboCop version 1.80.2.
3+
# on 2025-09-30 11:25:50 UTC using RuboCop version 1.80.2.
44
# The point is for the user to remove these configuration records
55
# one by one as the offenses are removed from the code base.
66
# Note that changes in the inspected code, or installation of new
@@ -20,7 +20,7 @@ Metrics/BlockLength:
2020
# Offense count: 1
2121
# Configuration parameters: CountComments, CountAsOne.
2222
Metrics/ClassLength:
23-
Max: 132
23+
Max: 135
2424

2525
# Offense count: 2
2626
# Configuration parameters: AllowedMethods, AllowedPatterns.

methods/_errors/common.json

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
"errors": {
3+
"ratelimited": "The request has been ratelimited. Refer to the Retry-After header for when to retry the request.",
4+
"unknown_method": "This method is currently not available.",
5+
"access_denied": "Access to a resource specified in the request is denied.",
6+
"account_inactive": "Authentication token is for a deleted user or workspace when using a bot token.",
7+
"deprecated_endpoint": "The endpoint has been deprecated.",
8+
"ekm_access_denied": "Administrators have suspended the ability to post a message.",
9+
"enterprise_is_restricted": "The method cannot be called from an Enterprise.",
10+
"is_bot": "This method cannot be called by a legacy bot.",
11+
"method_deprecated": "The method has been deprecated.",
12+
"missing_scope": "The token used is not granted the specific scope permissions required to complete this request.",
13+
"not_allowed_token_type": "The token type used in this request is not allowed.",
14+
"not_authed": "No authentication token provided.",
15+
"no_permission": "The workspace token used in this request does not have the permissions necessary to complete the request. Make sure your app is a member of the conversation it's attempting to post a message to.",
16+
"org_login_required": "The workspace is undergoing an enterprise migration and will not be available until migration is complete.",
17+
"token_expired": "Authentication token has expired.",
18+
"token_revoked": "Authentication token is for a deleted user or workspace or the app has been removed when using a user token.",
19+
"two_factor_setup_required": "Two factor setup is required.",
20+
"accesslimited": "Access to this method is limited on the current network.",
21+
"fatal_error": "The server could not complete your operation(s) without encountering a catastrophic error. It's possible some aspect of the operation succeeded before the error was raised.",
22+
"invalid_arg_name": "The method was passed an argument whose name falls outside the bounds of accepted or expected values. This includes very long names and names with non-alphanumeric characters other than _. If you get this error, it is typically an indication that you have made a very malformed API call.",
23+
"invalid_array_arg": "The method was passed an array as an argument. Please only input valid strings.",
24+
"invalid_charset": "The method was called via a POST request, but the charset specified in the Content-Type header was invalid. Valid charset names are: utf-8 iso-8859-1.",
25+
"invalid_form_data": "The method was called via a POST request with Content-Type application/x-www-form-urlencoded or multipart/form-data, but the form data was either missing or syntactically invalid.",
26+
"invalid_post_type": "The method was called via a POST request, but the specified Content-Type was invalid. Valid types are: application/json application/x-www-form-urlencoded multipart/form-data text/plain.",
27+
"missing_post_type": "The method was called via a POST request and included a data payload, but the request did not include a Content-Type header.",
28+
"request_timeout": "The method was called via a POST request, but the POST data was either missing or truncated.",
29+
"service_unavailable": "The service is temporarily unavailable.",
30+
"team_added_to_org": "The workspace associated with your request is currently undergoing migration to an Enterprise Organization. Web API and other platform operations will be intermittently unavailable until the transition is complete."
31+
}
32+
}

tasks/lib/slack_api/methods_generator.rb

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ def generate!
3232

3333
private
3434

35+
def common_errors
36+
@common_errors ||= JSON.load_file('methods/_errors/common.json')['errors']
37+
end
38+
3539
def process_method(data)
3640
args, fields = parse_args(data)
3741

@@ -45,7 +49,7 @@ def process_method(data)
4549
desc: strip_markdown(data['desc']),
4650
args: args,
4751
response: response,
48-
errors: errors
52+
errors: common_errors.merge(errors).sort.to_h
4953
}.merge(fields)
5054

5155
patch_filename = "methods/_patches/#{data['group']}/#{data['name']}.json"

0 commit comments

Comments
 (0)