do not create new error when error is catched

This commit is contained in:
Maren Süwer
2018-12-12 09:40:37 +01:00
parent 675f417d45
commit 8927d56b5c
6 changed files with 39 additions and 79 deletions

View File

@@ -32,9 +32,8 @@ export function fetchConfig(link: string) {
.then(data => {
dispatch(fetchConfigSuccess(data));
})
.catch(cause => {
const error = new Error(`could not fetch config: ${cause.message}`);
dispatch(fetchConfigFailure(error));
.catch(err => {
dispatch(fetchConfigFailure(err));
});
};
}
@@ -73,13 +72,8 @@ export function modifyConfig(config: Config, callback?: () => void) {
callback();
}
})
.catch(cause => {
dispatch(
modifyConfigFailure(
config,
new Error(`could not modify config: ${cause.message}`)
)
);
.catch(err => {
dispatch(modifyConfigFailure(config, err));
});
};
}