Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Should we unpack error messages in XState or components?#1961

Closed
Discussion options

This is a small question but I thought I'd use it as a chance to find out how GitHub discussions work. Maybe they'll work better than issues for decision-making?

I want to unpack error messages from errors in XServices instead of in components, because a) I don't think components should have to know what our API returns and b) I don't want to keepunknown types around any longer than necessary.

So currently our XServices have a lot of stuff like:onError, call the actionassignFooError, which puts the error incontext.fooError.

Sometimes, it first checks if the error is anApiError, and if so, it assumes the error contains anerrors array with error messages per form field. But there's another possibility: it's anApiError that contains just onemessage.

So I'm proposing:onError, call the actionassignFooErrorMessage, unpack the error withgetErrorMessage, and put it incontext.fooErrorMessage. And if it's form-related, then first check if ithasApiFieldErrors (a function I just wrote), if so unpack withmapApiErrorToFieldErrors instead of unpacking withgetErrorMessage.

This would result in eventually changing a lot of our error handling code, but I think itneeds an audit anyway.

You must be logged in to vote

Replies: 2 comments 6 replies

Comment options

👍 I like to have this unpacked in the machines instead of the components

You must be logged in to vote
6 replies
@code-asher
Comment options

@presleyp test mention

Unpacking in XState sounds ideal to me.

@greyscaled
Comment options

This sounds ideal to me as well!

@greyscaled
Comment options

@presleyp does the ping send to our Slack integration? This is a (second) test.

@greyscaled
Comment options

I wonder if someone replies if I'll see it in Slack as well :O

@presleyp
Comment options

@vapurrmaid It doesn't ping Slack. I do get push notifications on my phone though, because I have the GitHub app.

Comment options

@presleyp ,@bpmct has been working more in Discussions as well. 👍

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Labels
None yet
5 participants
@presleyp@misskniss@BrunoQuaresma@greyscaled@code-asher

[8]ページ先頭

©2009-2025 Movatter.jp