ohos.business_exception (General Exception Information)

Note:

Currently in the beta phase.

This module defines common exception information that occurs during interface calls.

Import Module

import ohos.business_exception.*

Note:

Kit import methods are not supported and are expected to be supported in the next version.

class BusinessException

public class BusinessException <: Exception {
    public let code: Int32
}

Description: Business exception class, inherits from the Exception class.

Since: 22

Parent Type:

  • Exception

let code

public let code: Int32

Description: Error code.

Type: Int32

Access: Read-only

Since: 22

func getData<T>()

public func getData<T>(): ?T

Description: Gets the custom data information carried in the exception.

Since: 22

Return Value:

Type Description
?T Additional supplementary exception information.

func toString()

public func toString(): String

Description: Gets the error message string.

Since: 22

Return Value:

Type Description
String Error message.

type AsyncCallback<T>

public type AsyncCallback<T> = (Option<BusinessException>, Option<T>) -> Unit

Description: Defines the asynchronous callback type.