diff --git a/manifest.json b/manifest.json index eb45f610016b71244dd34a3978e3d66225847c01..00c791648f04722c7fa535d0b412975bc39c8f52 100644 --- a/manifest.json +++ b/manifest.json @@ -1,6 +1,6 @@ { "name": "uni-api", - "appid": "__UNI__ED9218B", + "appid": "__UNI__8BF79AC", "description": "uts插件示例", "versionName": "1.0.0", "versionCode": "100", diff --git a/uni_modules/uni-exit/utssdk/app-ios/index.uts b/uni_modules/uni-exit/utssdk/app-ios/index.uts index 77a5905a3b956bcadf6f880c37af3fdb6dd9e711..3241c6768f55985371cde241a1aabb32cd904a25 100644 --- a/uni_modules/uni-exit/utssdk/app-ios/index.uts +++ b/uni_modules/uni-exit/utssdk/app-ios/index.uts @@ -1,5 +1,5 @@ import { ExitOptions, ExitFailCallback, ExitCompleteCallback, Exit} from "../interface.uts" -import { UniErrorSubject, UniErrors } from "../unierror.uts" +import { ExitFailImpl } from "../unierror.uts" /** @@ -7,7 +7,7 @@ import { UniErrorSubject, UniErrors } from "../unierror.uts" * iOS平台不支持,触发错误回调 */ export const exit : Exit = function (options: ExitOptions | null) { - let err = new UniError(UniErrorSubject, 12001, UniErrors.get(12001)!); + let err = new ExitFailImpl(12001); options?.fail?.(err) options?.complete?.(err) } diff --git a/uni_modules/uni-exit/utssdk/interface.uts b/uni_modules/uni-exit/utssdk/interface.uts index 0df1394ec6c9c81a8458b91b45f795118b835a62..923b4ff3c45108b089c29ab768e1ac288f3e2226 100644 --- a/uni_modules/uni-exit/utssdk/interface.uts +++ b/uni_modules/uni-exit/utssdk/interface.uts @@ -5,6 +5,21 @@ export type ExitSuccess = { errMsg: string } +/** + * 错误码 + * - 12001: 系统不支持 + * - 12002: 未知错误 + */ +export type ExitErrorCode = 12001 | 12002 + +/** + * uni.exit失败回调参数 + */ +export interface IExitError extends IUniError { + errCode: ExitErrorCode +} +export type ExitFail = IExitError + /** * uni.exit成功回调函数定义 */ @@ -12,7 +27,7 @@ export type ExitSuccessCallback = (res: ExitSuccess) => void /** * uni.exit失败回调函数定义 */ -export type ExitFailCallback = (res: UniError) => void +export type ExitFailCallback = (res: ExitFail) => void /** * uni.exit完成回调函数定义 */ diff --git a/uni_modules/uni-exit/utssdk/unierror.uts b/uni_modules/uni-exit/utssdk/unierror.uts index 68bbd48d3e2e508e2bf15033bb70223f116696b7..93518b7aa6e45e44674619741ce706f48cf5608b 100644 --- a/uni_modules/uni-exit/utssdk/unierror.uts +++ b/uni_modules/uni-exit/utssdk/unierror.uts @@ -1,3 +1,5 @@ +import { ExitErrorCode, IExitError } from "./interface.uts" + /** * 错误主题 */ @@ -18,3 +20,17 @@ export const UniErrors:Map = new Map([ */ [12002, 'unknown error'] ]); + +/** + * ExitFail的实现 + */ +export class ExitFailImpl extends UniError implements IExitError { + constructor ( + errCode: ExitErrorCode + ) { + super() + this.errSubject = UniErrorSubject + this.errCode = errCode + this.errMsg = UniErrors[errCode] ?? ""; + } +}