zulip-flutter icon indicating copy to clipboard operation
zulip-flutter copied to clipboard

api: Include stack trace when reporting MalformedServerResponseException

Open lakshya1goel opened this issue 1 year ago • 11 comments

Fixes: #1083

Changes:

  • Add causeStackTrace field to MalformedServerResponseException
  • Include stack trace in the exception's toString() output
  • Add test to verify stack trace is included in error messages

Testing:

  • Added unit test that verifies stack trace is included when a type mismatch occurs
  • Manually tested with registerQueue to confirm stack trace shows in error dialog

Screenshot of error

image

lakshya1goel avatar Feb 23 '25 07:02 lakshya1goel

It doesn't look like this new parameter causeStackTrace ever gets passed to the constructor. So it doesn't actually do anything in the live app.

Please test your change end to end in the app, and revise it so it solves the problem described in the issue:

When a request to the server fails, we typically show an error to the user. (The main gap in that is https://github.com/zulip/zulip-flutter/issues/890, which we should fix.) The details of the error can be useful, particularly if the user takes a screenshot of them to include in reporting the issue to us.

If the cause of the error is that the server's response doesn't match our expectations — a MalformedServerResponseException — then a key thing we want to know is where in the schema the mismatch occurred: what field of what type of object. […] So we should show the stack trace when reporting a MalformedServerResponseException.

gnprice avatar Feb 24 '25 21:02 gnprice

Hi @PIG208, whenever you get a chance, could you please take a look at my PR for an initial review? Thanks!

lakshya1goel avatar Mar 01 '25 11:03 lakshya1goel

Hi @PIG208, thanks for the above reviews. I have pushed the revision. PTAL.

lakshya1goel avatar Mar 09 '25 14:03 lakshya1goel

Thanks for the update! Left some comments.

PIG208 avatar Mar 10 '25 19:03 PIG208

Hi @PIG208, thanks for the review. I have pushed the revision. PTAL!

lakshya1goel avatar Mar 18 '25 14:03 lakshya1goel

Hi @PIG208 , whenever you get some time, please take a look at the PR. Thanks!

lakshya1goel avatar Mar 21 '25 14:03 lakshya1goel

Hi @PIG208, I have pushed the revision PTAL, Thanks!

lakshya1goel avatar Mar 25 '25 18:03 lakshya1goel

Hi @PIG208, I have pushed the revision as well as updates the PR description with the screenshot of error. PTAL, thanks!

lakshya1goel avatar Apr 02 '25 17:04 lakshya1goel

One other note: I think I wasn't clear in my previous #1374 (review) that I was referring to taking a screenshot of the error the user might see while using the app.

Should I add a snackbar or dailogbox in the app to show error to the user on the app screen?

lakshya1goel avatar Apr 15 '25 06:04 lakshya1goel

I think we shouldn't need to add a snack bar/dialog, since the error should have been handled from the polling loop in UpdateMachine.

Such an error might look like this:

image

PIG208 avatar Apr 15 '25 20:04 PIG208

As @PIG208 said above, I think we shouldn't need to add any new snack bar or dialog in order for the error to get shown to the user — the existing error dialog should do it.

But as the issue #1083 says, and as I emphasized in https://github.com/zulip/zulip-flutter/pull/1374#issuecomment-2679677776 at the top of this thread, the point of the issue is about what information we show to the user.

So, does this PR cause the stack trace to get shown to the user when they hit one of these errors? Please post a screenshot of what that looks like.

(The PR description currently has a screenshot of something shown in your terminal, as a developer. That isn't informative about what the user sees. If it were relevant information, then copy-paste into a code block would be a clearer way to present it than a screenshot.)

gnprice avatar Apr 15 '25 21:04 gnprice

Hi @lakshya1goel, please let us know if you're planning to update this following Greg's comment above.

chrisbobbe avatar Aug 06 '25 00:08 chrisbobbe

We've resolved this issue, in #1949, so closing this PR.

gnprice avatar Dec 12 '25 21:12 gnprice