Ballerina API Documentation

Functions of ballerina.lang.errors package

function getStackTrace(Error err) (StackTrace )

Provide access to StackTrace of an Error. StackTrace available only when an error is thrown. Otherwise, returns a null reference.

Parameters:

Parameter NameData TypeDescription
errErrorerr : The Error struct

Return Parameters:

Return VariableData TypeDescription
StackTraceballerina.lang.errors:StackTrace: StackTrace struct containing StackTrace of the error.

function toString(StackTraceItem item) (string )

Converts StackTraceItem details into a single string.

Parameters:

Parameter NameData TypeDescription
itemStackTraceItemerr : The StackTraceItem struct

Return Parameters:

Return VariableData TypeDescription
stringStackTraceItem details as a string.


Structs of ballerina.lang.errors package

struct Error

Fields:

Field NameData TypeDescription
msgstringAn error message explaining about the error.
causeErrorThe error that caused this Error to get thrown. the null reference is permitted. if the value is null, either cause is unknown or this error originated from itself.

struct NullReferenceError

Fields:

Field NameData TypeDescription
msgstringAn error message explaining about the error.
causeErrorThe error that caused this NullReferenceError to get thrown. the null reference is permitted. if the value is null, either cause is unknown or this NullReferenceError originated from itself.

struct StackTrace

Fields:

Field NameData TypeDescription
itemsStackTraceItem[]An array of StackTraceItem ordered by oldest to latest invocation.

struct StackTraceItem

Fields:

Field NameData TypeDescription
callerstringCaller's name of the current function/action/resource
packageNamestringPackage name of the current function/action/resource
fileNamestringFile name of the current function/action/resource
lineNumberintLast executed line number of the current function/action/resource

struct TypeCastError

Fields:

Field NameData TypeDescription
msgstringAn error message explaining about the error.
causeErrorThe error that caused this TypeCastingError to get thrown. the null reference is permitted. if the value is null, either cause is unknown or this TypeCastingError originated from itself.
sourceTypestringSource type
targetTypestringTarget type

struct TypeConversionError

Fields:

Field NameData TypeDescription
msgstringAn error message explaining about the error.
causeErrorThe error that caused this TypeConversionError to get thrown. the null reference is permitted. if the value is null, either cause is unknown or this TypeConversionError originated from itself.
sourceTypestringSource type
targetTypestringTarget type


Menu

  • Functions
    • getStackTrace(Error err) (StackTrace )
    • toString(StackTraceItem item) (string )
  • Structs
    • Error
    • NullReferenceError
    • StackTrace
    • StackTraceItem
    • TypeCastError
    • TypeConversionError

Copyright 2017 Ballerina API Documentation