OpenWorkspaceErrorMessage - cWorkspace

Returns a description for an error code that was returned opening a Workspace

Type: Function

Return Data Type: String

Parameters: Integer eErrorCode

ParameterDescription
eErrorCodean error-code constant that you want the natural-language description of


Return Value

A natural-langage description of the error.


Syntax
Function OpenWorkspaceErrorMessage Integer eErrorCode Returns String

Call: Get OpenWorkspaceErrorMessage eErrorCode to StringVariable


Description

OpenWorkspaceErrorMessage returns a natural-language description for an error code that was returned opening a Workspace, which is useful for giving users detailed reasons for the failure.

For example, if you passed wsWorkspaceNotFound as the eErrorCode parameter, then the return might be something similar to "The Workspace name was not found in the list of registered Workspaces."

Note:If you use cApplication's DoOpenWorkspace, then that method will automatically show the error translation before aborting.


In this example, an attempt is made to open a Workspace; if it fails, the error code is translated to a meaningful description and displayed:

Object oApplication is a cApplication

    Procedure OnCreate
        Handle hoWorkspace
        Integer eOpened
        String sError
 
        Get phoWorkspace To hoWorkspace
 
        Get OpenWorkspace of hoWorkspace "ABC, Inc.Accounts" To eOpened
        If (eOpened <> wsWorkspaceOpened) Begin
            Get OpenWorkspaceErrorMessage of hoWorkspace eOpened To sError
            Send Stop_Box sError "Error Opening Workspace"
            Abort
        End
    End_Procedure  // OnCreate

End_Object  // oApplication

See Also

DoOpenWorkspace