React-native-image-crop-picker: List of error code(s)

Created on 19 Dec 2018  路  2Comments  路  Source: ivpusic/react-native-image-crop-picker

Hi,
I'm using this awesome package to get profile photo and get cropped image in a multilanguage app.
I want to show a message/alert to the user when error occured and I need to translate every error types returned by catch method when ImagePicker.openPicker is called.

Is it possible to have a complete list of error code(s)?

Version

  • react-native-image-crop-picker v0.21.3
  • react-native v0.57.8

Platform

Both iOS and Android

Steps to reproduce

Calling this method:

...
getAndCropImage = () => {
    ImagePicker.openPicker({
      width: 300,
      height: 400,
      cropping: true
    }).then(image => {
      console.log(image);
    }).catch(err => console.log(err.code));
}
...

Most helpful comment

You can find your answer on this old closed issue:
https://github.com/ivpusic/react-native-image-crop-picker/issues/884#issuecomment-440379335

check https://github.com/ivpusic/react-native-image-crop-picker/blob/master/ios/src/ImageCropPicker.m#L10, top of file, defines with ERROR prefixes

You should take the string after the at sign.
i.e
#define ERROR_PICKER_CANCEL_KEY @"E_PICKER_CANCELLED"
the err.code returns is E_PICKER_CANCELLED

All 2 comments

You can find your answer on this old closed issue:
https://github.com/ivpusic/react-native-image-crop-picker/issues/884#issuecomment-440379335

check https://github.com/ivpusic/react-native-image-crop-picker/blob/master/ios/src/ImageCropPicker.m#L10, top of file, defines with ERROR prefixes

You should take the string after the at sign.
i.e
#define ERROR_PICKER_CANCEL_KEY @"E_PICKER_CANCELLED"
the err.code returns is E_PICKER_CANCELLED

Thank you so much @koo27 this is very helpful!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

fmcruz picture fmcruz  路  3Comments

habovh picture habovh  路  3Comments

victorwpbastos picture victorwpbastos  路  3Comments

equesteo picture equesteo  路  3Comments

cwRichardKim picture cwRichardKim  路  3Comments