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

Should throw error after catching it #133

Merged
merged 1 commit into from
Oct 13, 2023

Conversation

Pjaijai
Copy link
Owner

@Pjaijai Pjaijai commented Oct 13, 2023

No description provided.

@vercel
Copy link

vercel bot commented Oct 13, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
referalah ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 13, 2023 8:29pm

@Pjaijai Pjaijai added the feature New feature or request label Oct 13, 2023
@Pjaijai Pjaijai merged commit 98261bc into development Oct 13, 2023
3 checks passed
@Pjaijai Pjaijai deleted the feature/should-throw-after-caching-it branch October 13, 2023 20:30
@tommyttf
Copy link
Collaborator

It you throw it eventually without any handling in the catch block, then no need to catch it at the first place

@Pjaijai
Copy link
Owner Author

Pjaijai commented Oct 14, 2023

@tommyttf We do have some error handling in api hooks. If we don't throw error, the hooks will not run onError.

Pjaijai added a commit that referenced this pull request Oct 15, 2023
Co-authored-by: Pjaijai <paul6a24@hotmail.com>
@tommyttf
Copy link
Collaborator

tommyttf commented Oct 15, 2023

I mean

  createPost: async (req: ICreatePostRequest) => {
    try {
      await supabase.from("post").insert({
        url: req.url,
        country_uuid: req.countryUuid,
        province_uuid: req.provinceUuid,
        city_uuid: req.cityUuid,
        industry_uuid: req.industryUuid,
        year_of_experience: req.yearOfExperience,
        created_by: req.createdBy,
        type: req.type,
        company_name: req.companyName.trim(),
        job_title: req.jobTitle.trim(),
        description: req.description.trim(),
      })
    } catch (error) {
      throw error
    }
  },

is the same as

createPost: async (req: ICreatePostRequest) => {
    await supabase.from("post").insert({
      url: req.url,
      country_uuid: req.countryUuid,
      province_uuid: req.provinceUuid,
      city_uuid: req.cityUuid,
      industry_uuid: req.industryUuid,
      year_of_experience: req.yearOfExperience,
      created_by: req.createdBy,
      type: req.type,
      company_name: req.companyName.trim(),
      job_title: req.jobTitle.trim(),
      description: req.description.trim(),
    })
},

so no need to catch it here, just let it throw out to the onError handling

@Pjaijai
Copy link
Owner Author

Pjaijai commented Oct 15, 2023

Right will do some refactoring later.

Pjaijai added a commit that referenced this pull request Oct 21, 2023
* Feature/update backend setup on developer md (#104)

* Ignore local IDE config

* Update backend setup guidelines on developer.md

* Add supabase config guidelines

* Fix md syntax

* add CORS to edge func depending on the staging env

* Change to error toast (#106)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* add reply-to header to both contact email (#109)

* Feature/refactor search hook (#96)

* Refactor search hook in referral page

* Refactor referee search hook

* Remove useless import

* Refactor referee post

* Refactor referrer post search hook

* Remmove uesless import

* Change to error toast (#106)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Update email template (#117)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* [#120] set social media url to optional (#121)

Co-authored-by: Pjaijai <87293994+Pjaijai@users.noreply.github.com>

* Feature/make user profile page dynamic (#122)

* Make route dynamic

* Fix path

* Fix no user UI showing logic

* Hide edit button when user not in own profile

* Change matchedUser to isViewingOwnProfile

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/allow job title search (#111)

* Allow job title search in search referral api

* Add title in search referral hook

* Add input component to referral pages

* Add job title search in post pages

* Create reset button

* Adding reset to search refferal

* update reset button

* Adding reset to referral pages

* Adding reset to post seasrch

* Fix handle yeo min max change in post search

* Refine search bar styles

* Fix typo

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/make post referrer search input control component (#132)

* Remove (#92)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/update backend setup on developer md (#104)

* Ignore local IDE config

* Update backend setup guidelines on developer.md

* Add supabase config guidelines

* Fix md syntax

* add CORS to edge func depending on the staging env

* Change to error toast (#106)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* add reply-to header to both contact email (#109)

* Feature/refactor search hook (#96)

* Refactor search hook in referral page

* Refactor referee search hook

* Remove useless import

* Refactor referee post

* Refactor referrer post search hook

* Remmove uesless import

* Change to error toast (#106)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Update email template (#117)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* [#120] set social media url to optional (#121)

Co-authored-by: Pjaijai <87293994+Pjaijai@users.noreply.github.com>

* Feature/make user profile page dynamic (#122)

* Make route dynamic

* Fix path

* Fix no user UI showing logic

* Hide edit button when user not in own profile

* Change matchedUser to isViewingOwnProfile

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/allow job title search (#111)

* Allow job title search in search referral api

* Add title in search referral hook

* Add input component to referral pages

* Add job title search in post pages

* Create reset button

* Adding reset to search refferal

* update reset button

* Adding reset to referral pages

* Adding reset to post seasrch

* Fix handle yeo min max change in post search

* Refine search bar styles

* Fix typo

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Make them controlled component

* Version bump

* Make them controlled component

* Version bump

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>
Co-authored-by: Lulu <76647602+511234@users.noreply.github.com>
Co-authored-by: Thomas Yau <yaucp@connect.hku.hk>
Co-authored-by: Thomas Yau <github@yaucp.dev>

* Should (#133)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* add link to the DEVELOPER.md file in the "DEVELOPER.md" link (#141)

* Adding max words length

* Feature/config email testing on local environment (#138)

* Remove (#92)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* [#137] Config email testing on local environment

* Fix .env variable name

---------

Co-authored-by: Pjaijai <87293994+Pjaijai@users.noreply.github.com>
Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/cc sender when sending email (#140)

* Add sender email to cc

* Updating reminder text in contact dialog

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/adding type from supabase (#124)

* Adding supabase type

* Adding workflow files

* fix types

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/Adding initial data (#125)

* Adding initial data

* Update

* update st johns value

* Update

* Fix typo

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/revamp card (#135)

* Feature/update backend setup on developer md (#104)

* Ignore local IDE config

* Update backend setup guidelines on developer.md

* Add supabase config guidelines

* Fix md syntax

* add CORS to edge func depending on the staging env

* add reply-to header to both contact email (#109)

* Feature/refactor search hook (#96)

* Refactor search hook in referral page

* Refactor referee search hook

* Remove useless import

* Refactor referee post

* Refactor referrer post search hook

* Remmove uesless import

* Change to error toast (#106)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* create new card component for referrer and referee; update card skeleton; add missing modules in tailwind

* add referral post card; update referral post pages

* update contact toUuid; minor ui fix

* add items-center to info display

* Show edit button on profile page if logged-in user is profile user

* Fix build error

* Fix typos

* Import as module path

* Module import

* Using Link instead of onurlclick

* Fix import

* Remove id slug user page

* Remove showEditButton props

---------

Co-authored-by: Lulu <76647602+511234@users.noreply.github.com>
Co-authored-by: Thomas Yau <yaucp@connect.hku.hk>
Co-authored-by: Thomas Yau <github@yaucp.dev>
Co-authored-by: Pjaijai <87293994+Pjaijai@users.noreply.github.com>
Co-authored-by: Pjaijai <paul6a24@hotmail.com>
Co-authored-by: Lulu Tung <lulutheflaneur@gmail.com>

* Refactor/fix all formart problem (#142)

* Fix doc

* Fix format

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Hotfix/fix post duplication (#144)

* Fix IUserResponse type

* Fix api

* Fix type

* Fix api

* House keep

* Fetch 3 per page in search referral api

* Fix search post api

* House keep

* fix type

* fix format

* Fix number of order per page

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Feature/adding tailwind plugin (#145)

* Adding prettier-plugin-tailwindcss and prettier

* Fixing formart

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Bugfix/Card UI (#160)

* fix card ui bugs; modify the contact button of referral post card in mobile

* chaneg relative paths to absolute

* Bugfix/fix contact dialog text (#156)

* Fix text

* fix text

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Fix UI (#163)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Add word break (#162)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* Doc/adding local db dev guidelines (#146)

* Updating docs for backend local dev

* Fix typo

* House keep

* fix typo

---------

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

* version bump to 1.4.0 (#167)

Co-authored-by: Pjaijai <paul6a24@hotmail.com>

---------

Co-authored-by: Lulu <76647602+511234@users.noreply.github.com>
Co-authored-by: Thomas Yau <yaucp@connect.hku.hk>
Co-authored-by: Pjaijai <paul6a24@hotmail.com>
Co-authored-by: Thomas Yau <github@yaucp.dev>
Co-authored-by: Vardy <wadee@wadeenghoiwa.com>
Co-authored-by: marukosy124 <54564324+marukosy124@users.noreply.github.com>
Co-authored-by: Lulu Tung <lulutheflaneur@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants