From 89981849244488bd9a1ff0d54ce80d637821613e Mon Sep 17 00:00:00 2001 From: bunyaminakcay Date: Fri, 5 Sep 2025 13:50:10 +0300 Subject: [PATCH] Title: Accessor for BusinessError code Issue: ICWNJX Testing: Build Signed-off-by: bunyaminakcay --- base_sdk/ets/@ohos.base.ets | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/base_sdk/ets/@ohos.base.ets b/base_sdk/ets/@ohos.base.ets index 39ec6945..48464751 100644 --- a/base_sdk/ets/@ohos.base.ets +++ b/base_sdk/ets/@ohos.base.ets @@ -14,22 +14,30 @@ */ export class BusinessError extends Error { - code: int; + private code_: int; data?: T; + get code(): int { + return this.code_ + } + + set code(val: int) { + this.code_ = val + } + constructor() { super(); - this.code = 0; + this.code_ = 0; } constructor(code: int, error: Error) { super(error.name, error.message, {cause: error.cause} as ErrorOptions); - this.code = code; + this.code_ = code; } constructor(code: int, data: T, error: Error) { super(error.name, error.message, {cause: error.cause} as ErrorOptions); - this.code = code; + this.code_ = code; this.data = data; } } -- Gitee