Initial commit
This commit is contained in:
34
uni_modules/uni-getbatteryinfo/utssdk/unierror.uts
Normal file
34
uni_modules/uni-getbatteryinfo/utssdk/unierror.uts
Normal file
@@ -0,0 +1,34 @@
|
||||
import { GetBatteryInfoErrorCode, GetBatteryInfoFail } from "./interface.uts"
|
||||
/**
|
||||
* 错误主题
|
||||
*/
|
||||
export const UniErrorSubject = 'uni-getBatteryInfo';
|
||||
|
||||
|
||||
/**
|
||||
* 错误信息
|
||||
* @UniError
|
||||
*/
|
||||
export const UniErrors : Map<GetBatteryInfoErrorCode, string> = new Map([
|
||||
/**
|
||||
* 错误码及对应的错误信息
|
||||
*/
|
||||
[1001, 'getBatteryInfo:fail getAppContext is null'],
|
||||
]);
|
||||
|
||||
|
||||
/**
|
||||
* 错误对象实现
|
||||
*/
|
||||
export class GetBatteryInfoFailImpl extends UniError implements GetBatteryInfoFail {
|
||||
|
||||
/**
|
||||
* 错误对象构造函数
|
||||
*/
|
||||
constructor(errCode : GetBatteryInfoErrorCode) {
|
||||
super();
|
||||
this.errSubject = UniErrorSubject;
|
||||
this.errCode = errCode;
|
||||
this.errMsg = UniErrors[errCode] ?? "";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user