[
https://issues.apache.org/jira/browse/CB-4071?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13709330#comment-13709330
]
Jonathan Bond-Caron commented on CB-4071:
-----------------------------------------
Problem so far is how can I return a CaptureError from Android or iOS?
I came up with a little hack:
https://github.com/jbondc/cordova-js/commit/14134809dad4de034bd5f199c250710f6c4f3e0a
The idea would be to allow iOS,Android,... anything returning JSON through the
native bridges to set a property called 'objectInstance'.
Here's what Android could return:
https://github.com/jbondc/cordova-plugin-media-capture/commit/b1daf6dc93b98e277bb98dfb51e70e70226ceacc
Thoughts?
I haven't tested the code so it may need tweaking, don't have the full cordova
build stack setup.
> Capture error callback (should be an object)
> --------------------------------------------
>
> Key: CB-4071
> URL: https://issues.apache.org/jira/browse/CB-4071
> Project: Apache Cordova
> Issue Type: Bug
> Components: Android, Docs, iOS, Windows 8
> Affects Versions: 2.9.0
> Environment: All
> Reporter: Jonathan Bond-Caron
> Assignee: Joe Bowser
> Fix For: 3.1.0
>
>
> When using camera.getPicture(), the cameraError is documented as a string but
> on Android & iOS, it's actually an object.
> On the native side in 2.7:
> Android:
> private static final int CAPTURE_INTERNAL_ERR = 0;
> // private static final int CAPTURE_APPLICATION_BUSY = 1;
> // private static final int CAPTURE_INVALID_ARGUMENT = 2;
>
> private static final int CAPTURE_NO_MEDIA_FILES = 3;
> iOS:
> enum CDVCaptureError {
>
> CAPTURE_INTERNAL_ERR = 0,
>
> CAPTURE_APPLICATION_BUSY = 1,
>
> CAPTURE_INVALID_ARGUMENT = 2,
>
> CAPTURE_NO_MEDIA_FILES = 3,
>
> CAPTURE_NOT_SUPPORTED = 20
> };
> Windows 8:
> only string errors
> Android and iOS have the same looking api on the native side, error callback
> Android returns JSON: {message: '', code: int}, iOS returns JSON: {message:
> '', status: int},
> Looking at the javascript api, it looks like it should return a 'new
> CaptureError()' on the errorCallback, is that the direction for 3.0?
> Windows only sends a string as the callback error, it's difficult to know if
> the user just cancelled taking a picture or what kind of specific error
> occurred.
> Should I look into creating a patch?
> This probably affects other apis, overall I'd like to see the CaptureError()
> returned more consistently instead of strings.
> It would make sense to improve this in 3.0 and possibly break BC for those
> expecting strings.
> CaptureError() could implement 'toString()' to mitigate potential issues.
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators
For more information on JIRA, see: http://www.atlassian.com/software/jira