PBDOM_EXCEPTION

Description

The PBDOM_EXCEPTION class is derived from the PowerBuilder Exception class.

Methods

This class extends the Exception class with one method that returns the unique code that identifies the exception being thrown:

GetExceptionCode

GetExceptionCode

Description

Returns the code of the exception being thrown.

Syntax

pbdom_exception.GetExceptionCode()

Argument

Description

pbdom_exception

The name of a PBDOM_EXCEPTION object


Return value

Long.

The code value associated with the exception being thrown.

Examples

In this example, an attempt to call the PBDOM_ELEMENT GetAttribute method on the root element of a PBDOM_DOCUMENT with the parameter xmlns:nuskin causes an exception to be thrown, because the name is not a valid NCName (no-colon-name). The correct way to get an attribute that belongs to a namespace is to use the namespace version of the PBDOM_ELEMENT GetAttribute method.

The EXCEPTION_INVALID_NAME (code value 11) exception is thrown and is displayed in a message box:

PBDOM_DOCUMENT   pbdom_doc1
PBDOM_DOCUMENT   pbdom_get_doc
PBDOM_ELEMENT   pbdom_elem_root
PBDOM_ATTRIBUTE   pbdom_attr
PBDOM_OBJECT     pbdom_obj

try
  pbdom_doc1 = Create PBDOM_DOCUMENT

  pbdom_doc1.NewDocument("nuskin", &
     "http://www.nuskin.com", "nuskin:root", "", "")
  pbdom_elem_root = pbdom_doc1.GetRootElement()
  pbdom_attr = &
   pbdom_elem_root.GetAttribute("xmlns:nuskin")

catch (PBDOM_EXCEPTION pbdom_except)
  MessageBox ("Exception", "Code : " & 
     + string(pbdom_except.GetExceptionCode()) &
     + "~r~nText : " + pbdom_except.Text)
end try

Usage

For a list of exception codes, see PBDOM exceptions. For a description of the conditions under which each exception can occur, see PBDOM exception descriptions.

See also

GetAttribute Syntax 2 (PBDOM_ELEMENT)

GetMessage and SetMessage in the section called “GetMessage” in PowerScript Reference and the section called “SetMessage” in PowerScript Reference.