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

I forgot one error string for the Android readFile() method #475

Merged
merged 5 commits into from
Aug 10, 2017
Merged

I forgot one error string for the Android readFile() method #475

merged 5 commits into from
Aug 10, 2017

Conversation

lll000111
Copy link
Contributor

Belongs to issue #460

@lll000111 lll000111 closed this Aug 9, 2017
@lll000111 lll000111 deleted the temp1 branch August 9, 2017 19:51
@lll000111 lll000111 restored the temp1 branch August 9, 2017 19:51
@lll000111 lll000111 reopened this Aug 9, 2017
@lll000111
Copy link
Contributor Author

I looked at how the "error system" is used and will send a new pull request shortly:

Reference in RN:

The promise reject() method has three arguments:

  1. code This is not supposed to be text but something for the machine, like Unix error codes
  2. message This is text for human consumption
  3. The internal error object

The third parameter is not actually sent to Javascript at this point, at least not for Android (I didn't find out how RCTPromiseRejectBlock treats that 3rd parameter).

Both code and message go directly to the respective properties of the Javascript Error object.

My intention for my next PR is

  • To change the 1st parameter to a CODE (same in Android and iOS of course)
  • To add code for "interesting errors" - mostly "File not found". Right now this is a) differently handled by iOS and Android implementation and actually also by each filesystem function, b) results in a default error, so that "file not found" cannot actually be determined from the error message because that information is lost.

@wkh237 Writing in your code feels like walking into your house and moving the furniture around, it's really strange. That's why I'd like to ask beforehand, do you agree with the proposed changes?

@wkh237 wkh237 merged commit 873cb80 into wkh237:0.10.9 Aug 10, 2017
@wkh237
Copy link
Owner

wkh237 commented Aug 10, 2017

@lll000111 , that's great 👍 I think the error message does need lot of improvement. Besides, I really appreciate your help and feedback 😄

@lll000111 lll000111 deleted the temp1 branch August 10, 2017 08:26
danielsuo added a commit to danielsuo/react-native-fetch-blob that referenced this pull request Feb 13, 2018
* upstream/0.10.9:
  Fixed problem with type casting (wkh237#513)
  My proposed 0.10.9 changes (wkh237#489)
  wkh237#268 Cancelled task should not trigger `then` promise function
  Add ability to cancel android DownloadManager fetches (wkh237#502)
  Fix iOS initialization race condition (wkh237#499)
  prevent UIApplication methods from being called on background thread (wkh237#486)
  Implemenet fs.hash() -- wkh237#439 "Feature: Calculate file hash" (wkh237#476)
  I forgot one error string for the Android readFile() method (wkh237#475)
  Fix for wkh237#467 (wkh237#472)
  Fix for issue wkh237#468, wkh237#461, wkh237#460 and minor cleanup (wkh237#469)
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.

None yet

4 participants