goatslacker / goatslacker/alt

StoreMixin: Seems impossible to handle an error without Storemixin throwing it in any case

Open
#348 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
3.4k
Forks
312
PR merge metrics
No merged PRs in 30d

Description

We're using static function in stores to trigger xhr calls - as far as i can see they are defined correctly. However it seems impossible to avoid that the Storemixin itself throws an error. As far as i understand the alt-source the following line will always be triggered if an xhr error occurs:
https://github.com/goatslacker/alt/blob/9d228dce2295890cb9a0ea114bd5840a128ba55d/src/alt/store/StoreMixin.js#L57

Is this the desired behaviour? I mean to pass in a truthy value in any case?
https://github.com/goatslacker/alt/blob/9d228dce2295890cb9a0ea114bd5840a128ba55d/src/alt/store/StoreMixin.js#L70

**\* Sample Code for an XHR Handler ***

```
const DesignSource = (alt) => {
return {
rate: {
remote(state, rating, designId) {
return api.post('designs/' + designId + '/rate', {
rating: rating
});
},
success: alt.getActions(designs').addRating,
error: alt.getActions('designs').xhrError
}
};
};
```

Contributor guide

Open the contributing guide

Research direction

Start in src/alt/store/StoreMixin.js at the referenced lines 57 and 70, then trace the sample DesignSource XHR error path. Reproduce whether StoreMixin always throws despite the configured error handler and determine the intended error-propagation behavior; done means that behavior is clarified and the issue's concern is resolved.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.