Skip to content
This repository has been archived by the owner on Jan 16, 2024. It is now read-only.

Fix #1210 and more issues by removing one level of "response" #1352

Closed
wants to merge 2 commits into from

Conversation

norbertschuler
Copy link
Collaborator

@norbertschuler norbertschuler commented Aug 30, 2019

Fix #1210
Fix #1211
Fix #1003

I think this is the same duplication of trying to access a response object as in 968a9fc - is it?

@norbertschuler norbertschuler changed the title Fix #1210 and #1211 by removing one level of "response" Fix #1210 and more issues by removing one level of "response" Aug 30, 2019
@@ -36,11 +36,11 @@ export function editTree(plantContribution, plantId, navigation) {
dispatch(setProgressModelState(false));
updateRoute('app_userHome', navigation || dispatch);
})
.catch(error => {
debug(error.response);
.catch(response => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A Promise must only reject with an Error. The only thing .catch can catch would be an Error.

putAuthenticatedRequest is .catching errors, handling that with onAPIError which then throws an Error. It does not throw a Response

@crucialfelix
Copy link
Contributor

See: axios/axios#960 (comment)

It's axios that would throw the error. The error would have the response at error.response

but ... the error was thrown by something else before axios even got called:

  let url = await getApiRoute(route, params);
await getHeaders(authenticated)

@norbertschuler
Copy link
Collaborator Author

norbertschuler commented Aug 31, 2019

I think I better discard this patch too.

@norbertschuler norbertschuler deleted the feature/fix_response_handling branch September 1, 2019 07:42
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

TypeError in /challenge TypeError in /challenge ReferenceError in /my-trees
2 participants