29 lines
963 B
Plaintext
29 lines
963 B
Plaintext
import { CodeScanErrorCode, CodeScanFail } from './interface.uts'
|
|
|
|
export const CodeScanErrorSubject = 'mas-code-scan'
|
|
|
|
export const CodeScanErrorText: Map<CodeScanErrorCode, string> = new Map([
|
|
[9021001, '当前无法获取页面 Activity'],
|
|
[9021002, '相机权限被拒绝'],
|
|
[9021003, '用户取消扫码'],
|
|
[9021004, '未获取到有效的扫码结果'],
|
|
[9021005, '相机被其他应用占用或当前不可用'],
|
|
[9021006, '设备不支持手电筒'],
|
|
[9021007, '相机初始化失败'],
|
|
[9021008, '相册图片无法读取'],
|
|
[9021009, '图片中未识别到条码'],
|
|
[9021010, '指定码制不支持'],
|
|
[9021011, '扫码超时']
|
|
])
|
|
|
|
export class CodeScanFailImpl extends UniError implements CodeScanFail {
|
|
override errCode: CodeScanErrorCode
|
|
|
|
constructor(errCode: CodeScanErrorCode) {
|
|
super()
|
|
this.errSubject = CodeScanErrorSubject
|
|
this.errCode = errCode
|
|
this.errMsg = CodeScanErrorText.get(errCode) ?? ''
|
|
}
|
|
}
|