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

[WEB-139] Error handling and checks on creation #80

Conversation

archessmn
Copy link
Member

Added some Error handling and other various checks before channel creation / channel join / channel invite

Copy link

linear bot commented Jan 7, 2024

WEB-139 Slack integration can't be added to an existing channel

Error:

Error: An API error occurred: name_taken
    at platformErrorFromResult (/app/.next/server/chunks/101.js:9:78413)
    at WebClient.apiCall (/app/.next/server/chunks/101.js:9:69279)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async $$ACTION_0 (/app/.next/server/app/(authenticated)/calendar/new/page.js:1:4706)
    at async /app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:111:479
    at async rs (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:110:4701)
    at async rT (/app/node_modules/next/dist/compiled/next-server/app-page.runtime.prod.js:111:27761)
    at async doRender (/app/node_modules/next/dist/server/base-server.js:1343:26)
    at async cacheEntry.responseCache.get.incrementalCache.incrementalCache (/app/node_modules/next/dist/server/base-server.js:1503:28)
    at async NextNodeServer.renderToResponseWithComponentsImpl (/app/node_modules/next/dist/server/base-server.js:1411:28

users: user.slack_user_id,
});
// Check if channel exists from previous API calls
if (channel_info?.ok) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Doesn’t the API client throw an error, instead of returning a non-ok response object?

Change thrown errors to returned messages that will get displayed
properly to the client.
@@ -37,6 +38,11 @@ export default function SlackChannelField(props: { parentName: string }) {

return (
<>
{ctx.formState.errors.slack_channel && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this use props.parentName somehow?

@@ -38,13 +38,13 @@ export default function SlackChannelField(props: { parentName: string }) {

return (
<>
{ctx.formState.errors.slack_channel && (
{ctx.formState.errors[`${props.parentName}`] && (
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: this can just be formState.errors[props.parentName]

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated

@markspolakovs markspolakovs merged commit 746c4d2 into main Feb 4, 2024
3 checks passed
@markspolakovs markspolakovs deleted the web-139-slack-integration-cant-be-added-to-an-existing-channel branch February 4, 2024 18:27
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 this pull request may close these issues.

2 participants