Skip to content

[FIX] incorrect error toast messages - #26320

Merged
ggazzo merged 16 commits into
developfrom
fix/undefined-error-toad-again
Aug 16, 2022
Merged

ggazzo merged 16 commits into
developfrom
fix/undefined-error-toad-again

Conversation

@debdutdeb

@debdutdeb debdutdeb commented Jul 20, 2022 •

Copy link
Copy Markdown
Member

Proposed changes (including videos or screenshots)

Issue(s)

https://open.rocket.chat/channel/rocketchat-dev?msg=NHaMAkZDYssEEBZW4

Steps to test or reproduce

Further comments

useEndpoint throws an object that doesn't implement toString which is causing String(error) to resolve to [object Object] even though the object contains the error property. On the other hand handleError checks for both message and error properties along with doing other things (and now defaults to a string conversion) so there is no need to check type on runtime and cast for each instance manually.

* `handleError` handles all property checks and casting (if necessary)
@debdutdeb
debdutdeb requested a review from a team as a code owner July 20, 2022 17:41
@debdutdeb debdutdeb changed the title [FIX] undefined error toast message on user-edit admin view [FIX] [object Object] error toast message on user-edit admin view Jul 20, 2022
@debdutdeb debdutdeb changed the title [FIX] [object Object] error toast message on user-edit admin view [FIX] incorrect error toast message Jul 20, 2022
@ggazzo ggazzo added the stat: ready to merge PR tested and approved waiting for merge label Jul 20, 2022
@debdutdeb

Copy link
Copy Markdown
Member Author

ignore the very incorrect branch name 🙈

@debdutdeb debdutdeb added this to the 5.0.0 milestone Jul 20, 2022
@casalsgh casalsgh changed the title [FIX] incorrect error toast message [Regression] incorrect error toast message Jul 20, 2022
@casalsgh casalsgh changed the title [Regression] incorrect error toast message [Fix] incorrect error toast message Jul 20, 2022
@casalsgh casalsgh modified the milestones: 5.0.0, 5.0.1 Jul 20, 2022
@debdutdeb debdutdeb changed the title [Fix] incorrect error toast message [FIX] incorrect error toast message Jul 20, 2022
@debdutdeb
debdutdeb marked this pull request as draft July 20, 2022 19:26
@debdutdeb debdutdeb changed the title [FIX] incorrect error toast message [FIX] incorrect error toast messages Jul 20, 2022
@debdutdeb debdutdeb added stat: needs QA and removed stat: ready to merge PR tested and approved waiting for merge stat: QA skipped labels Jul 26, 2022
`useEndpoint` throws a serialized object that doesn't implement `toString` which is causing `String(error)` to resolve to `[object Object]` even though the object contains the `error` property. On the other hand `handleError` checks for both `message` and `error` properties along with doing other things (and now defaults to a string conversion) so there is no need to check type on runtime and cast for each instance.
@debdutdeb
debdutdeb marked this pull request as ready for review July 26, 2022 17:53
@casalsgh casalsgh modified the milestones: 5.0.1, 5.0.2 Aug 1, 2022
@casalsgh casalsgh added this to the 5.1.0 milestone Aug 1, 2022
@codecov

codecov Bot commented Aug 10, 2022 •

Copy link
Copy Markdown

Codecov Report

Merging #26320 (d117667) into develop (49fa71a) will increase coverage by 0.13%.
The diff coverage is 5.98%.

Impacted file tree graph

@@             Coverage Diff             @@
##           develop   #26320      +/-   ##
===========================================
+ Coverage    38.51%   38.65%   +0.13%     
===========================================
  Files          758      758              
  Lines        18818    18820       +2     
  Branches      1461     1452       -9     
===========================================
+ Hits          7247     7274      +27     
+ Misses       11354    11328      -26     
- Partials       217      218       +1     
Flag Coverage Δ
e2e 38.65% <5.98%> (+0.13%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@tassoevan tassoevan left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I screwed up big time in this one.

However, I don't like the idea of slapping any at the caught errors... I believe a better approach for it is introducing a new function that takes an unknown-type error and uses dispatchToastMessage under the hood to figure the "stringification" out.

@debdutdeb
debdutdeb requested a review from a team as a code owner August 12, 2022 04:02
@lgtm-com

lgtm-com Bot commented Aug 12, 2022

Copy link
Copy Markdown

This pull request introduces 1 alert when merging 11d3ffe into 50af9b2 - view on LGTM.com

new alerts:

  • 1 for Comparison between inconvertible types

@debdutdeb
debdutdeb requested a review from a team as a code owner August 15, 2022 13:25

@d-gubert d-gubert left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Looking good on the Apps-Engine side

@ggazzo
ggazzo merged commit 1928374 into develop Aug 16, 2022
@ggazzo
ggazzo deleted the fix/undefined-error-toad-again branch August 16, 2022 16:22
csuadev pushed a commit that referenced this pull request Aug 26, 2022
Co-authored-by: Tasso Evangelista <tasso.evangelista@rocket.chat>
@murtaza98 murtaza98 mentioned this pull request Sep 2, 2022
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.

6 participants