GetFormattedError

Returns two strings in a given language that provide information on an error. One string contains a user-readable description of the error; the other string contains technical details for debugging purposes. The error is identified by an error number and description.

Tip:

To apply a given line feed character to the technical details string, use GetFormattedErrorWithLineFeed.

Syntax

<HsvResourceManager>.GetFormattedError lLanguageId, hr, bstrXMLError, bstrDefaultError, pvarbstrFormattedError, pvarbstrTechnicalError

Argument

Description

lLanguageId

Long (ByVal). The language ID of the language. You can obtain the IDs of a Financial Management release’s valid languages with GetAvailableLanguages.

Tip:

The HFMConstants enumeration tagHFM_LANGUAGES represents language IDs that are valid for all releases; for more information, see Supported Language Constants.

hr

Long (ByVal). The HRESULT that identifies the error.

Tip:

In VBScript, you can get the HRESULT with the Number property of the Err object.

bstrXMLError

String (ByVal). The XML string that describes the error.

Tip:

In VBScript, you can get the XML string with the Description property of the Err object.

bstrDefaultError

String (ByVal). A default error message string. If the error is not generated by Financial Management, the specified default string is returned by the pvarbstrFormattedError argument.

The way this works is that GetFormattedError first looks for a resource string that corresponds to the XML string passed in the bstrXMLError argument. If no matching resource string is found, GetFormattedError looks for a resource string that corresponds to the passed HRESULT. If no matching resource string is found, then the default string is returned.

pvarbstrFormattedError

Variant. Returns a simple description of the error. This is text that can be displayed to the user.

pvarbstrTechnicalError

Variant. Returns detailed technical information regarding the error. For more information, see System Message Detail Strings.

Example

The following function takes a language ID and returns the corresponding error message. The passed language ID is compared to the languages returned by GetAvailableLanguages; if no match is found, the language ID for the default language is passed to GetFormattedError.

Function getHFMError(lId)
Dim cResourceManager, vaIDs, vaNames
Dim lLanguageID, vUserError, vTechError
Set cResourceManager = Server.CreateObject("Hyperion.HsvResourceManager")
cResourceManager.Initialize HFM_WEB_TIER
cResourceManager.GetAvailableLanguages vaIDs, vaNames
' Cast the passed language ID as a String
lId = cStr(lId)
' Set a default language ID.
lLanguageID = HFM_LANGUAGE_DEFAULT
For i = LBound(vaIDs) To UBound(vaIDs)
  If lId = vaIDs(i)Then
    ' If the passed language is available, override the
    ' previously set default language ID.
    lLanguageID = lId
    Exit For
  End If
Next
cResourceManager.GetFormattedError lLanguageID, Err.Number, _ 
  Err.Description, "Unknown Error", vUserError, vTechError
getHFMError = vUserError
End Function