This commit is contained in:
lixudong 2024-06-24 12:08:09 +08:00
parent ef2d49e93d
commit 559a897896
2 changed files with 38 additions and 37 deletions

View File

@ -20,34 +20,35 @@ import {CommonFunctions} from "../../../utils/checkUtils";
export class CheckErrorCode {
static errorCodeList: number[] = [201, 202, 203, 301, 401, 501, 502, 801, 901];
static errorCodeList: number[] = [201, 202, 203, 301, 401, 501, 502, 801, 901];
static isArrayNotEmpty(arr: any): boolean {
return Array.isArray(arr) && arr.length > 0;
}
/**
* arr1中的每个数字是否在数组arr2中
* @param arr1
* @param arr2
*/
static hasNumberInArray(arr1: number[], arr2: number[]): boolean {
return arr1.every(num => arr2.includes(num));
}
static checkErrorCode(apiJsdoc: Comment.JsDocInfo): ErrorTagFormat {
const checkResult: ErrorTagFormat = {
state: true,
errorInfo: '',
};
const errorCodes = apiJsdoc.errorCodes.filter(number => number >= 100 && number < 1000);;
if (this.isArrayNotEmpty(errorCodes)) {
if (!this.hasNumberInArray(errorCodes, this.errorCodeList)) {
checkResult.state = false;
checkResult.errorInfo = ErrorMessage.ERROR_ERROR_CODE;
}
}
return checkResult;
static isArrayNotEmpty(arr: any): boolean {
return Array.isArray(arr) && arr.length > 0;
}
/**
* arr1中的每个数字是否在数组arr2中
* @param arr1
* @param arr2
*/
static hasNumberInArray(arr1: number[], arr2: number[]): boolean {
return arr1.every(num => arr2.includes(num));
}
static checkErrorCode(apiJsdoc: Comment.JsDocInfo): ErrorTagFormat {
const checkResult: ErrorTagFormat = {
state: true,
errorInfo: '',
};
const errorCodes = apiJsdoc.errorCodes.filter(number => number >= 100 && number < 1000);
;
if (this.isArrayNotEmpty(errorCodes)) {
if (!this.hasNumberInArray(errorCodes, this.errorCodeList)) {
checkResult.state = false;
checkResult.errorInfo = ErrorMessage.ERROR_ERROR_CODE;
}
}
return checkResult;
}
}

View File

@ -24,15 +24,15 @@
* @since 6
*/
export interface StartBLEScanOptions {
/**
* Initializes the connected NFC tag.
*
* @throws { BusinessError } 209 - Capability not supported.
* @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service.
* @syscap SystemCapability.Communication.ConnectedTag
* @since 9
*/
initialize(): void;
/**
* Initializes the connected NFC tag.
*
* @throws { BusinessError } 209 - Capability not supported.
* @throws { BusinessError } 3200101 - Connected NFC tag running state is abnormal in service.
* @syscap SystemCapability.Communication.ConnectedTag
* @since 9
*/
initialize(): void;
}