Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Catch exceptions thrown by Slack SDK #11

Closed
jkehres opened this issue Dec 2, 2019 · 1 comment · Fixed by #14
Closed

Catch exceptions thrown by Slack SDK #11

jkehres opened this issue Dec 2, 2019 · 1 comment · Fixed by #14

Comments

@jkehres
Copy link
Owner

jkehres commented Dec 2, 2019

I would agree with this issue:

slackapi/node-slack-sdk#775

Error handling is not intuitive for the Slack SDK. The result object returned by an API call has an ok property, which indicates the API will never reject/throw and you need to check the result to determine the success. However, in practice the SDK will reject/throw. We are not currently handling this in the code. This is particularly bad in the stream lambda since we could stuck trying to process the same record forever when we hit a Slack API error that is permanent.

@jkehres
Copy link
Owner Author

jkehres commented Dec 2, 2019

Here is an example error object thrown by the SDK:

{
    "errorType": "Error",
    "errorMessage": "An API error occurred: channel_not_found",
    "code": "slack_webapi_platform_error",
    "data": {
        "ok": false,
        "error": "channel_not_found",
        "response_metadata": {
            "scopes": [
                "identify",
                "bot:basic"
            ],
            "acceptedScopes": [
                "chat:write:bot",
                "post"
            ]
        }
    },
    "stack": [
        "Error: An API error occurred: channel_not_found",
        "    at Object.platformErrorFromResult (/var/task/node_modules/@slack/web-api/dist/errors.js:50:33)",
        "    at WebClient.apiCall (/var/task/node_modules/@slack/web-api/dist/WebClient.js:423:28)",
        "    at process._tickCallback (internal/process/next_tick.js:68:7)"
    ]
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant