From 96eefd450bb538fbd6c9570d452be1e7a4633db3 Mon Sep 17 00:00:00 2001 From: zhangzezhong Date: Tue, 8 Jul 2025 09:22:30 +0800 Subject: [PATCH] upd BusinessError Signed-off-by: zhangzezhong --- frameworks/ets/ani/BUILD.gn | 1 - .../ani/ani_common/src/ani_common_util.cpp | 23 ++++--- .../ets/ani/uri_permission_manager/BUILD.gn | 20 ------ ....app.ability.UIExtensionContentSession.ets | 12 ++-- ...@ohos.application.uriPermissionManager.ets | 65 +++++++++---------- frameworks/ets/ets/BUILD.gn | 21 ++++++ .../ets/ets/application/AbilityDelegator.ets | 35 +++++----- .../ets/ets/application/UIAbilityContext.ets | 55 ++++++---------- .../ets/application/UIExtensionContext.ets | 12 ++-- frameworks/ets/ets/utils/AbilityUtils.ets | 8 +-- 10 files changed, 120 insertions(+), 132 deletions(-) rename frameworks/ets/{ani/uri_permission_manager => }/ets/@ohos.application.uriPermissionManager.ets (67%) diff --git a/frameworks/ets/ani/BUILD.gn b/frameworks/ets/ani/BUILD.gn index 2c324d61cd..2d2fb6e34b 100644 --- a/frameworks/ets/ani/BUILD.gn +++ b/frameworks/ets/ani/BUILD.gn @@ -19,7 +19,6 @@ group("ani_packages") { "${ability_runtime_path}/frameworks/ets/ani/ability_delegator:ability_delegator_registry_ani_kit", "${ability_runtime_path}/frameworks/ets/ani/ani_common:ani_common", "${ability_runtime_path}/frameworks/ets/ani/native_constructor:context_ani", - "${ability_runtime_path}/frameworks/ets/ani/uri_permission_manager:uri_permission_manager_abc_etc", "${ability_runtime_path}/frameworks/ets/ani/uri_permission_manager:uri_permission_manager_ani_kit", ] } diff --git a/frameworks/ets/ani/ani_common/src/ani_common_util.cpp b/frameworks/ets/ani/ani_common/src/ani_common_util.cpp index dc8cf62e7a..cecb72225a 100644 --- a/frameworks/ets/ani/ani_common/src/ani_common_util.cpp +++ b/frameworks/ets/ani/ani_common/src/ani_common_util.cpp @@ -459,26 +459,29 @@ bool AsyncCallback(ani_env *env, ani_object call, ani_object error, ani_object r TAG_LOGE(AAFwkTag::ANI, "null env"); return false; } - ani_status status = ANI_ERROR; ani_class clsCall = nullptr; - - if ((status = env->FindClass(CLASSNAME_ASYNC_CALLBACK_WRAPPER, &clsCall)) != ANI_OK) { - TAG_LOGE(AAFwkTag::ANI, "status: %{public}d", status); + ani_status status = env->FindClass(CLASSNAME_ASYNC_CALLBACK_WRAPPER, &clsCall); + if (status!= ANI_OK || clsCall == nullptr) { + TAG_LOGE(AAFwkTag::ANI, "FindClass status: %{public}d, or null clsCall", status); return false; } ani_method method = nullptr; - if ((status = env->Class_FindMethod( - clsCall, "invoke", "L@ohos/base/BusinessError;Lstd/core/Object;:V", &method)) != ANI_OK) { - TAG_LOGE(AAFwkTag::ANI, "status: %{public}d", status); + if ((status = env->Class_FindMethod(clsCall, "invoke", nullptr, &method)) != ANI_OK || method == nullptr) { + TAG_LOGE(AAFwkTag::ANI, "Class_FindMethod status: %{public}d, or null method", status); return false; } - if (result == nullptr) { + if (error == nullptr) { ani_ref nullRef = nullptr; env->GetNull(&nullRef); - result = reinterpret_cast(nullRef); + error = reinterpret_cast(nullRef); + } + if (result == nullptr) { + ani_ref undefinedRef = nullptr; + env->GetUndefined(&undefinedRef); + result = reinterpret_cast(undefinedRef); } if ((status = env->Object_CallMethod_Void(call, method, error, result)) != ANI_OK) { - TAG_LOGE(AAFwkTag::ANI, "status: %{public}d", status); + TAG_LOGE(AAFwkTag::ANI, "Object_CallMethod_Void status: %{public}d", status); return false; } return true; diff --git a/frameworks/ets/ani/uri_permission_manager/BUILD.gn b/frameworks/ets/ani/uri_permission_manager/BUILD.gn index 80b2d35616..ea9f3d4ec4 100644 --- a/frameworks/ets/ani/uri_permission_manager/BUILD.gn +++ b/frameworks/ets/ani/uri_permission_manager/BUILD.gn @@ -82,24 +82,4 @@ ohos_shared_library("uri_permission_manager_ani_kit") { innerapi_tags = [ "platformsdk" ] subsystem_name = "ability" part_name = "ability_runtime" -} - -generate_static_abc("uri_permission_manager_abc") { - base_url = "./ets" - - files = [ "./ets/@ohos.application.uriPermissionManager.ets" ] - - dst_file = "$target_out_dir/uri_permission_manager.abc" - out_puts = [ "$target_out_dir/uri_permission_manager.abc" ] - - is_boot_abc = "True" - device_dst_file = "/system/framework/uri_permission_manager.abc" -} - -ohos_prebuilt_etc("uri_permission_manager_abc_etc") { - source = "$target_out_dir/uri_permission_manager.abc" - module_install_dir = "framework" - subsystem_name = "ability" - part_name = "ability_runtime" - deps = [ ":uri_permission_manager_abc" ] } \ No newline at end of file diff --git a/frameworks/ets/ets/@ohos.app.ability.UIExtensionContentSession.ets b/frameworks/ets/ets/@ohos.app.ability.UIExtensionContentSession.ets index a51a633afa..e1e5e6642f 100644 --- a/frameworks/ets/ets/@ohos.app.ability.UIExtensionContentSession.ets +++ b/frameworks/ets/ets/@ohos.app.ability.UIExtensionContentSession.ets @@ -45,9 +45,9 @@ export default class UIExtensionContentSession { } terminateSelf(): Promise { - let p = new Promise((resolve: (data: undefined) => void, reject:(err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + let p = new Promise((resolve: (data: undefined) => void, reject:(err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -68,9 +68,9 @@ export default class UIExtensionContentSession { } terminateSelfWithResult(parameter: AbilityResult): Promise { - let p = new Promise((resolve: (data: undefined) => void, reject:(err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + let p = new Promise((resolve: (data: undefined) => void, reject:(err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); diff --git a/frameworks/ets/ani/uri_permission_manager/ets/@ohos.application.uriPermissionManager.ets b/frameworks/ets/ets/@ohos.application.uriPermissionManager.ets similarity index 67% rename from frameworks/ets/ani/uri_permission_manager/ets/@ohos.application.uriPermissionManager.ets rename to frameworks/ets/ets/@ohos.application.uriPermissionManager.ets index 44fc2eedc8..403a0c969e 100644 --- a/frameworks/ets/ani/uri_permission_manager/ets/@ohos.application.uriPermissionManager.ets +++ b/frameworks/ets/ets/@ohos.application.uriPermissionManager.ets @@ -15,18 +15,7 @@ import wantConstant from '@ohos.app.ability.wantConstant'; import { BusinessError, AsyncCallback } from '@ohos.base'; - -export class AsyncCallbackWrapper { - myFun_:AsyncCallback = (err: BusinessError, data: T) => {} - - constructor(myFun:AsyncCallback){ - this.myFun_ = myFun; - } - - invoke(err: BusinessError, data: T) : void { - this.myFun_(err, data); - } -} +import AsyncCallbackWrapper from './utils/AbilityUtils'; export default namespace uriPermissionManager { loadLibrary("uri_permission_manager_ani_kit.z"); @@ -37,16 +26,20 @@ export default namespace uriPermissionManager { callback: AsyncCallbackWrapper): void; export function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string): Promise { - let p:Promise = new Promise((resolve: (data: number)=>void, reject:(err: BusinessError)=>void):void => { - let callbackWrapper = new AsyncCallbackWrapper((err: BusinessError, data: number)=>{ - if (err.code == 0) { - resolve(data); + let p:Promise = new Promise((resolve: (data: number)=>void, reject:(err: BusinessError)=>void):void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null, data: number | undefined)=>{ + if (err === null || err.code === 0) { + if (data === undefined) { + resolve(-1); + } else { + resolve(data); + } } else { reject(err); } }); taskpool.execute((): void => { - uriPermissionManager.grantUriPermissionCallbackSync(uri, flag, targetBundleName, 0, callbackWrapper); + uriPermissionManager.grantUriPermissionCallbackSync(uri, flag, targetBundleName, 0, myCall); }); }); return p; @@ -54,9 +47,9 @@ export default namespace uriPermissionManager { export function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string, appCloneIndex: number): Promise { - let p:Promise = new Promise((resolve: (data:undefined)=>void, reject:(err: BusinessError)=>void):void => { - let callbackWrapper = new AsyncCallbackWrapper((err: BusinessError, data: number)=>{ - if (err.code == 0) { + let p:Promise = new Promise((resolve: (data:undefined)=>void, reject:(err: BusinessError)=>void):void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null, data: number | undefined)=>{ + if (err === null || err.code === 0) { resolve(undefined); } else { reject(err); @@ -64,7 +57,7 @@ export default namespace uriPermissionManager { }); taskpool.execute((): void => { uriPermissionManager.grantUriPermissionCallbackSync(uri, - flag, targetBundleName, appCloneIndex, callbackWrapper); + flag, targetBundleName, appCloneIndex, myCall); }); }); return p; @@ -72,48 +65,52 @@ export default namespace uriPermissionManager { export function grantUriPermission(uri: string, flag: wantConstant.Flags, targetBundleName: string, callback: AsyncCallback): void { - let callbackWrapper = new AsyncCallbackWrapper(callback); + let myCall = new AsyncCallbackWrapper(callback); taskpool.execute((): void => { - uriPermissionManager.grantUriPermissionCallbackSync(uri, flag, targetBundleName, 0, callbackWrapper); + uriPermissionManager.grantUriPermissionCallbackSync(uri, flag, targetBundleName, 0, myCall); }) } export function revokeUriPermission(uri: string, targetBundleName: string): Promise { - let p:Promise = new Promise((resolve: (data: number)=>void, reject:(err: BusinessError)=>void):void => { - let callbackWrapper = new AsyncCallbackWrapper((err: BusinessError, data: number)=>{ - if (err.code == 0) { - resolve(data); + let p:Promise = new Promise((resolve: (data: number)=>void, reject:(err: BusinessError)=>void):void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null, data: number | undefined)=>{ + if (err === null || err.code === 0) { + if (data === undefined) { + resolve(-1); + } else { + resolve(data); + } } else { reject(err); } }); taskpool.execute((): void => { - uriPermissionManager.revokeUriPermissionCallbackSync(uri, targetBundleName, 0, callbackWrapper); + uriPermissionManager.revokeUriPermissionCallbackSync(uri, targetBundleName, 0, myCall); }); }); return p; } export function revokeUriPermission(uri: string, targetBundleName: string, appCloneIndex: number): Promise { - let p:Promise = new Promise((resolve: (data:undefined)=>void, reject:(err: BusinessError)=>void):void => { - let callbackWrapper = new AsyncCallbackWrapper((err: BusinessError, data: number)=>{ - if (err.code == 0) { + let p:Promise = new Promise((resolve: (data:undefined)=>void, reject:(err: BusinessError)=>void):void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null, data: number | undefined)=>{ + if (err === null || err.code === 0) { resolve(undefined); } else { reject(err); } }); taskpool.execute((): void => { - uriPermissionManager.revokeUriPermissionCallbackSync(uri, targetBundleName, appCloneIndex, callbackWrapper); + uriPermissionManager.revokeUriPermissionCallbackSync(uri, targetBundleName, appCloneIndex, myCall); }); }); return p; } export function revokeUriPermission(uri: string, targetBundleName: string, callback: AsyncCallback): void { - let callbackWrapper = new AsyncCallbackWrapper(callback); + let myCall = new AsyncCallbackWrapper(callback); taskpool.execute((): void => { - uriPermissionManager.revokeUriPermissionCallbackSync(uri, targetBundleName, 0, callbackWrapper); + uriPermissionManager.revokeUriPermissionCallbackSync(uri, targetBundleName, 0, myCall); }) } } \ No newline at end of file diff --git a/frameworks/ets/ets/BUILD.gn b/frameworks/ets/ets/BUILD.gn index 799dbd505d..07098f4a8b 100644 --- a/frameworks/ets/ets/BUILD.gn +++ b/frameworks/ets/ets/BUILD.gn @@ -454,6 +454,26 @@ ohos_prebuilt_etc("ability_runtime_ability_stage_context_abc_etc") { deps = [ ":ability_runtime_ability_stage_context_abc" ] } +generate_static_abc("uri_permission_manager_abc") { + base_url = "./" + + files = [ "./@ohos.application.uriPermissionManager.ets" ] + + dst_file = "$target_out_dir/uri_permission_manager.abc" + out_puts = [ "$target_out_dir/uri_permission_manager.abc" ] + + is_boot_abc = "True" + device_dst_file = "/system/framework/uri_permission_manager.abc" +} + +ohos_prebuilt_etc("uri_permission_manager_abc_etc") { + source = "$target_out_dir/uri_permission_manager.abc" + module_install_dir = "framework" + subsystem_name = "ability" + part_name = "ability_runtime" + deps = [ ":uri_permission_manager_abc" ] +} + group("ets_packages") { deps = [ ":ability_delegator_abc_etc", @@ -481,6 +501,7 @@ group("ets_packages") { ":ability_runtime_ui_ability_context_abc_etc", ":service_extension_ability_abc_etc", ":ui_extension_ability_ani_etc", + ":uri_permission_manager_abc_etc", ":form_extension_ability_etc", ] } diff --git a/frameworks/ets/ets/application/AbilityDelegator.ets b/frameworks/ets/ets/application/AbilityDelegator.ets index 568379f2c7..efeab82590 100644 --- a/frameworks/ets/ets/application/AbilityDelegator.ets +++ b/frameworks/ets/ets/application/AbilityDelegator.ets @@ -67,9 +67,9 @@ class AbilityDelegatorInner implements AbilityDelegator { } finishTest(msg: string, code: number): Promise { let p: Promise = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -97,14 +97,15 @@ class AbilityDelegatorInner implements AbilityDelegator { } executeShellCommand(cmd: string, timeoutSecs?: number): Promise { let p = new Promise((resolve: (data: ShellCmdResult) => void, - reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError, data: ShellCmdResult) => { - if (err.code == 0) { - resolve(data); - } else { - reject(err); - } - }); + reject: (err: BusinessError) => void): void => { + let myCall = + new AsyncCallbackWrapper((err: BusinessError | null, data: ShellCmdResult | undefined) => { + if (err == null || err.code == 0) { + resolve(data as ShellCmdResult); + } else { + reject(err); + } + }); taskpool.execute((): void => { if (timeoutSecs == null) { this.nativeExecuteShellCommand(cmd, 0, myCall); @@ -124,9 +125,9 @@ class AbilityDelegatorInner implements AbilityDelegator { } addAbilityMonitor(monitor: AbilityMonitor): Promise { let p = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -147,9 +148,9 @@ class AbilityDelegatorInner implements AbilityDelegator { } startAbility(want: Want): Promise { let p: Promise = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); diff --git a/frameworks/ets/ets/application/UIAbilityContext.ets b/frameworks/ets/ets/application/UIAbilityContext.ets index 4c515cb3f6..f332edf4f1 100644 --- a/frameworks/ets/ets/application/UIAbilityContext.ets +++ b/frameworks/ets/ets/application/UIAbilityContext.ets @@ -21,20 +21,7 @@ import { AbilityResult } from 'ability.abilityResult'; import { Configuration } from '@ohos.app.ability.Configuration'; import Context from 'application.Context'; import window from '@ohos.window'; - -export class AsyncCallbackWrapper { - myFun_: AsyncCallback = (err: BusinessError, data: T) => { - } - - constructor(myFun: AsyncCallback) { - console.log("AsyncCallbackWrapper"); - this.myFun_ = myFun; - } - - invoke(err: BusinessError, data: T): void { - this.myFun_(err, data); - } -} +import AsyncCallbackWrapper from '../utils/AbilityUtils'; export default class UIAbilityContext extends Context { static { @@ -85,9 +72,9 @@ export default class UIAbilityContext extends Context { startAbility(want: Want): Promise { let p: Promise = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -102,9 +89,9 @@ export default class UIAbilityContext extends Context { startAbility(want: Want, options: StartOptions): Promise { let p = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -133,10 +120,10 @@ export default class UIAbilityContext extends Context { startAbilityForResult(want: Want): Promise { let p = new Promise((resolve: (data: AbilityResult) => void, - reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError, data: AbilityResult) => { - if (err.code == 0) { - resolve(data); + reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null, data: AbilityResult | undefined) => { + if (err == null || err.code == 0) { + resolve(data as AbilityResult); } else { reject(err); } @@ -150,10 +137,10 @@ export default class UIAbilityContext extends Context { startAbilityForResult(want: Want, startOptions: StartOptions): Promise { let p = new Promise((resolve: (data: AbilityResult) => void, - reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError, data: AbilityResult) => { - if (err.code == 0) { - resolve(data); + reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null, data: AbilityResult | undefined) => { + if (err == null || err.code == 0) { + resolve(data as AbilityResult); } else { reject(err); } @@ -174,9 +161,9 @@ export default class UIAbilityContext extends Context { terminateSelf(): Promise { let p = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -198,9 +185,9 @@ export default class UIAbilityContext extends Context { terminateSelfWithResult(parameter: AbilityResult): Promise { let p = - new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + new Promise((resolve: (data: undefined) => void, reject: (err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); diff --git a/frameworks/ets/ets/application/UIExtensionContext.ets b/frameworks/ets/ets/application/UIExtensionContext.ets index 4ebea3b15a..f4037cbb75 100644 --- a/frameworks/ets/ets/application/UIExtensionContext.ets +++ b/frameworks/ets/ets/application/UIExtensionContext.ets @@ -31,9 +31,9 @@ export default class UIExtensionContext extends ExtensionContext { } terminateSelf(): Promise { - let p = new Promise((resolve: (data: undefined) => void, reject:(err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + let p = new Promise((resolve: (data: undefined) => void, reject:(err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); @@ -54,9 +54,9 @@ export default class UIExtensionContext extends ExtensionContext { } terminateSelfWithResult(parameter: AbilityResult): Promise { - let p = new Promise((resolve: (data: undefined)=>void, reject:(err: BusinessError) => void): void => { - let myCall = new AsyncCallbackWrapper((err: BusinessError) => { - if (err.code == 0) { + let p = new Promise((resolve: (data: undefined)=>void, reject:(err: BusinessError) => void): void => { + let myCall = new AsyncCallbackWrapper((err: BusinessError | null) => { + if (err == null || err.code == 0) { resolve(undefined); } else { reject(err); diff --git a/frameworks/ets/ets/utils/AbilityUtils.ets b/frameworks/ets/ets/utils/AbilityUtils.ets index 989136ed5b..166e0017f2 100644 --- a/frameworks/ets/ets/utils/AbilityUtils.ets +++ b/frameworks/ets/ets/utils/AbilityUtils.ets @@ -19,14 +19,14 @@ const DOMAIN_ID = 0xD001300; const TAG = 'AbilityUtils'; const LEVEL = 100; -export default class AsyncCallbackWrapper { - private myFun_:AsyncCallback = (err: BusinessError, data: T) => {} +export default class AsyncCallbackWrapper { + private myFun_: AsyncCallback = (err: BusinessError | null, data: T | undefined) => {} - constructor(myFun:AsyncCallback){ + constructor(myFun: AsyncCallback) { this.myFun_ = myFun; } - invoke(err: BusinessError, data: T) : void { + invoke(err: BusinessError | null, data: T | undefined): void { this.myFun_(err, data); } }