目录

ArkTS API Error Codes

This section describes only module-specific error codes. For details about universal error codes, please refer to Universal Error Codes.

1000500001 Internal Error

[h2]Algorithm Exception

Message

Description

This error code is reported when an algorithm exception occurs.

Possible causes

An algorithm exception occurs during barcode image generation or image-based barcode recognition.

Solution

Call the barcode image generation or image-based barcode recognition API again.

[h2]Barcode Image Generation Failed

Message

Internal error. Failed to create pixelMap.

Description

This error code is reported when the pixelMap fails to be created during barcode image generation.

Possible causes

The image creation logic is abnormal.

Solution

Call the barcode image generation API again.

[h2]Failed to Obtain the Image

Message

Internal error. Failed to read file.

Description

This error code is reported when a file fails to be read.

Possible causes

The input URI is invalid.

Solution

Check the URI passed.

[h2]Failed to Obtain the System Context

Message

Description

This error code is reported when the system context fails to be obtained.

Possible causes

The context passed in is incorrect.

Solution

Check the context input parameter.

[h2]Failed to Obtain the Callback

Message

Internal error. Get callback failed.

Description

This error code is reported when the callback fails to be obtained.

Possible causes

The callback passed in is abnormal.

Solution

Check the callback input parameter.

[h2]Permission Error

Message

Internal error. Permission error.

Description

This error code is reported when a permission error occurs.

Possible causes

The app does not have the camera permission.

Solution

Apply for the camera permission in module.json5 and code.

[h2]Incorrect API Call Sequence

Message

Description

This error code is reported when the API call sequence is incorrect.

Possible causes

APIs are not called in the correct sequence. For example, the customScan.start API is called before customScan.init.

Solution

Adjust the sequence for calling APIs. For example, call the customScan.init API first and then the customScan.start API.

[h2]API Call Not Allowed

Message

Internal error. The interface can't be used in promise interface.

Description

This error code is reported when the API is called using a promise in customScan.start.

Possible causes

The customScan.rescan API is called using a promise in customScan.start.

Solution

Call the customScan.rescan API using a callback in customScan.start.

[h2]Unmatched Resolution

Message

Internal error. The width and height of viewcontrol do not match the width and height supported by the camera.

Description

This error code is reported when the aspect ratio of the ViewControl does not match the camera resolution.

Possible causes

The aspect ratio of the ViewControl does not match the camera resolution.

Solution

Check the aspect ratio of the ViewControl.

[h2]Camera Error

Message

Description

This error code is reported when a camera error occurs.

Possible causes

Solution

Create the service again.

1000500002 Scanning Canceled by User

Message

The user canceled the barcode scanning.

Description

This error code is reported when a user cancels scanning.

Possible causes

The user tapped the close button or swiped back to cancel scanning.

Solution

This error code is reported in the scenario where scanBarcode.startScanForResult is called. Handle the subsequent business process after a user cancels scanning.