About handling failure
See original GitHub issueHi guys,
In the following saga, I deliberately returned an error
/**
* Authentication saga
*/
export function *loginFlow () {
while (true) {
let request = yield take(LOGIN_REQUEST);
let error = 'Invalid username or password';
yield put(loginFailure(error));
}
}
And my redux-form
:
const { handleSubmit, error, submitting } = this.props;
const onSubmit = handleSubmit(actions.formAction);
return (
<div>
<form className="ui large form" onSubmit={onSubmit}>
// ...
</form>
{ error &&
(
<div className="ui error message">
<span>Login failed</span>
</div>
)
}
</div>
)
I expected to see the error message of Login failed
when the form’s submitted. But what I’ve got is a Promise rejection:
Would you please tell me how to handle rejections properly?
Issue Analytics
- State:
- Created 6 years ago
- Comments:8
Top Results From Across the Web
Managing Yourself: Can You Handle Failure?
The first is to listen and communicate. It sounds obvious, but most of us forget to gather enough feedback or sufficiently explain our...
Read more >9 Strategies for How To Deal With Failure (Plus Tips) - Indeed
1. Acknowledge your feelings · 2. Recognize irrational beliefs · 3. Release the need for approval · 4. Accept responsibility · 5. Don't...
Read more >10 Healthy Ways to Cope With Failure - Verywell Mind
Embrace Your Emotions · Recognize Unhealthy Attempts to Reduce Pain · Practice Healthy Coping Skills · Acknowledge Irrational Beliefs About Failure.
Read more >8 Ways Smart People Use Failure To Their Advantage - Forbes
People who are bad at handling failure tend to blame failure on their laziness, lack of intelligence or some other personal quality, which ......
Read more >Coping with failure - Student services directory
Top tips for coping with failure · Give yourself permission to feel · Practise self-compassion · Reflect on the experience and adopt a...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@dandonahoe proper usage is following:
const submitForm = createFormAction('SUBMIT_FORM')
handleSubmit
function of your form:<form onSubmit={handleSubmit(submitForm)}>
submitForm.REQUEST
action in your saga and handle it:Updated README as well