Menu

1 / 2

Error handling in Twenty codebase — part 1.1

DEV Community·Ramu Narasinga·6 months ago
#JxSiayD9
#l18#l95#opensource#twenty#error
Reading 0:00
15s threshold

Inspired by BulletProof React, .

I applied its codebase architecture concepts to thestructured, Twenty codebase. .

This article focuses only on the error handling strategies used in Twenty codebase. .

Approach

In part 1.0, I mentioned that Bulletproof React mentions three ways of error handling:

API errors

In app errors

Error tracking

In this article, I want to provide examples and references to how Twenty handled in-app errors. The approach we take is simple:

Pick onSubmit method in CreateProfile.tsx file. .

Review how the error is handled.

In this part 1.0, we review the onSubmit method in CreateProfile.tsx file. .

CreateProfile.tsx

CreateProfile modal is rendered during the onboarding on the twenty.com . platform, we will review the onSubmit method:

const onSubmit : SubmitHandler < Form > = useCallback ( async ( data ) => { try { if ( ! currentWorkspaceMember ?. id ) { throw new Error ( ' User is not logged in ' ); } if ( ! data . firstName || ! data .…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.