react-native-pdf icon indicating copy to clipboard operation
react-native-pdf copied to clipboard

Clarify the type of error in onError

Open Sharcoux opened this issue 4 years ago • 1 comments

What react-native version are you using? 0.64.0

What react-native-pdf version are you using? 6.3.0

What platform does your issue occur on? (android/ios/both) both

The type of error object returned by onError is object which is unclear. Moreover, the documentation says: if password error, will call OnError() with message "Password required or incorrect password.", which opens lot of doubts:

  1. Is error a string and I Should write onError ={error => error.includes('password') && askPassword()}?
  2. Is error of type Error and I should write: onError={error => error.message.includes('password') && askPassword()}
  3. Can error be something else than an Error and so I should do: onError={error => error?.message?.includes('password') && askPassword()}?

Just clarifying the type and the documentation about this might help the lib users.

Beside that, thanks a lot for your job!

Sharcoux avatar Apr 24 '21 17:04 Sharcoux

+1

amie-wilt avatar May 11 '21 16:05 amie-wilt