Namespace: Consultingwerk.Util
Class 
ErrorHelper Copy to Clipboard
Parent classes:
Inherits: Progress.Lang.Object

File:ErrorHelper
Purpose:Various support routines for structured error handling
Syntax:Static methods only, Protected constructor to disallow
instance creation
Author(s):Mike Fechner / Consultingwerk Ltd.
Created:Sat Jul 04 13:29:48 CEST 2009



Top Method Summary
Options Name Purpose
+ CHARACTER AddErrorMessage (character, character, character, character) Adds an ADM2 style formatted error message to an existing error message string
+ LONGCHAR AddErrorMessage (longchar, character, character, character) Adds an ADM2 style formatted error message to an existing error message string
# AddJsonErrorDetails (Error, JsonObject) Adds the properties of the given error to the given JSON object
+ CHARACTER DatasetErrorStrings (handle) Returns a single CHARACTER string composed of the error-strings of all records (from all tables in the given Dataset instance)
+ DeRegisterErrorHandler (IErrorHandler) Deregisters the IErrorHandler implementation
+ DeRegisterStopConditionHandler (IStopConditionHandler) Deregisters the IStopConditionHandler implementation
+ CHARACTER ErrorTitle (Error) Returns the Title associated with an error message
+ CHARACTER ErrorTypeName (Error) Returns the Typename of the error object
+ CHARACTER FormattedErrorMessages (Error) Returns a single CHARACTER string composed of the messages Contained in the Progress.Lang.Error object
+ CHARACTER FormattedErrorMessagesExt (Error) Returns a single CHARACTER string composed of the messages Contained in the Progress.Lang.Error object, including the stack trace and the text of inner exceptions when present
+ CHARACTER GetMsgDataFileName (integer) Returns the file name containing the message description data
+ CHARACTER GetMsgDescription (integer) Returns the error message description for the given ABL error message
+ CHARACTER GetRuntimeErrorMessage (integer) Returns the text of the given ABL error message
+ CHARACTER GetSmartMessage (character) Formats a SmartMessage
# LOGICAL HandleError (Error) Handles an Error object using the registered IErrorHandler implementations
+ LOGICAL HasMessageNumber (Error, integer) Returns if the error instance contains an error message with the given message number
+ IgnoreError (Error, integer) Ignores specific Progress.Lang.SysErrors and throws all others
+ IgnoreError (Error, integer, integer) Ignores specific Progress.Lang.SysErrors and throws all others
+ IgnoreError (Error, integer, integer, integer) Ignores specific Progress.Lang.SysErrors and throws all others
+ IgnoreError (Error, integer, integer, integer, integer) Ignores specific Progress.Lang.SysErrors and throws all others
+ IgnoreError (Error, integer, integer, integer, integer, integer) Ignores specific Progress.Lang.SysErrors and throws all others
+ LOGICAL IsRemoteThrowable (Error) Returns if the error is throwable from an AppServer to an ABL client
+ Progress.Json.ObjectModel.JsonObject JsonErrorDetails (Error) Returns a Json Object with the error details
+ Consultingwerk.Util.Error132Info ParseError132 (SysError) Parses an 132 runtime Error and returns the table and field/values (** Salesrep already exists with Sales Rep "bbb". (132))
+ RegisterErrorHandler (IErrorHandler) Registers a new IErrorHandler implementation
+ RegisterStopConditionHandler (IStopConditionHandler) Registers a new IStopConditionHandler implementation
+ ResetErrorStatus () Resets the ERROR-STATUS:ERROR and ERROR-STATUS:NUM-MESSAGES etc.
# ShowDialog (Form, Form) Shows the dialog form
+ ShowErrorMessage (Error) Display Error Message
+ ShowErrorMessage (Error, character) Display Error Message
+ ShowErrorMessage (Error, character, Form) Display Error Message
+ ShowErrorMessage (Error, Form) Display Error Message
+ ShowErrorMessageBox (Error) Display Error Message as an alert-box (to be used in functions and non-void methods due to WAIT-FOR limitations)
+ ShowErrorMessageBox (Error, character) Display Error Message as an alert-box (to be used in functions and non-void methods due to WAIT-FOR limitations)
+ CHARACTER StackTrace (Error) Reformats the Error Stack Trace (most current code block first, not last as provided by the CallStack attribute

Top Constructor Summary
Options Name Purpose
# ErrorHelper () Protected default constructor.

Top Property Summary
Options Name Purpose
+ CHARACTER CurrentStacktrace
+ LOGICAL ErrorMessageDialogAllowed
+ CHARACTER ErrorMessageFormType
+ CHARACTER STOP_AFTER_MESSAGE
+ CHARACTER STOP_LOCK_CONFLICT_MESSAGE
+ CHARACTER STOP_MESSAGE
+ CHARACTER STOP_USER_INTERRUPT_MESSAGE
+ LOGICAL SuppressTableAndFieldInfo


Method Detail
Top

PUBLIC CHARACTER AddErrorMessage (character, character, character, character)

Purpose: Adds an ADM2 style formatted error message to an existing error
message string
Notes:

Parameters:
pcMessage CHARACTER
The existing message text
pcText CHARACTER
The text of the additional message
pcField CHARACTER
The field that the message belongs to
pcTable CHARACTER
The table that the message belongs to
Returns CHARACTER
The resulting message text
Top

PUBLIC LONGCHAR AddErrorMessage (longchar, character, character, character)

Purpose: Adds an ADM2 style formatted error message to an existing error
message string
Notes:

Parameters:
pcMessage LONGCHAR
The existing message text
pcText CHARACTER
The text of the additional message
pcField CHARACTER
The field that the message belongs to
pcTable CHARACTER
The table that the message belongs to
Returns LONGCHAR
The resulting message text
Top

PROTECTED AddJsonErrorDetails (Error, JsonObject)

Purpose: Adds the properties of the given error to the given JSON object
Notes: Processes inner errors if available

Parameters:
poError Progress.Lang.Error
The Error to parse
poJsonObject Progress.Json.ObjectModel.JsonObject
The JsonObject to add the error details to
Top

PUBLIC CHARACTER DatasetErrorStrings (handle)

Purpose: Returns a single CHARACTER string composed of the error-strings
of all records (from all tables in the given Dataset instance)
Notes: Method moved to DatasetHelper, kept here for backwards compability
as a facade to DatasetHelper:DatasetErrorStrings

Parameters:
phDataset HANDLE
The handle of the dataset to return the error strings from
Returns CHARACTER
The string composed of the error-strings of all records
Top

PUBLIC DeRegisterErrorHandler (IErrorHandler)

Purpose: Deregisters the IErrorHandler implementation
Notes:

Parameters:
poErrorHandler Consultingwerk.Framework.IErrorHandler
The IErrorHandler to deregister
Top

PUBLIC DeRegisterStopConditionHandler (IStopConditionHandler)

Purpose: Deregisters the IStopConditionHandler implementation
Notes:

Parameters:
poStopConditionHandler Consultingwerk.Framework.IStopConditionHandler
The IStopConditionHandler to deregister
Top

PUBLIC CHARACTER ErrorTitle (Error)

Purpose: Returns the Title associated with an error message
Notes: Errors that implemnt the IErrorTitle interface return their own title
For other errors, when the SmartFramework is present the type name is
used as the message key when looking up translations in the "Error"
translation scope.
When no title could be obtained, a default title is returned from this
routine

Parameters:
poError Progress.Lang.Error
The reference to the error object
Returns CHARACTER
The title associated with the error message
Top

PUBLIC CHARACTER ErrorTypeName (Error)

Purpose: Returns the Typename of the error object
Notes: Required as .NET Exceptions don't have an ABL Class
(GetClass() returns ?)

Parameters:
e Progress.Lang.Error
The Error (Progress error of .NET Exception) to return the type name for
Returns CHARACTER
The type name (class name) of the error object
Top

PUBLIC CHARACTER FormattedErrorMessages (Error)

Purpose: Returns a single CHARACTER string composed of the messages
Contained in the Progress.Lang.Error object
Notes:

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error to format
Returns CHARACTER
A string containing all formatted messages from the Error object
Top

PUBLIC CHARACTER FormattedErrorMessagesExt (Error)

Purpose: Returns a single CHARACTER string composed of the messages
Contained in the Progress.Lang.Error object, including the stack
trace and the text of inner exceptions when present
Notes: Useful when logging complex error objects to a file

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error to format
Returns CHARACTER
A string containing all formatted messages from the Error object
Top

PUBLIC CHARACTER GetMsgDataFileName (integer)

Purpose: Returns the file name containing the message description data
Notes: https://knowledgebase.progress.com/articles/Article/19758

Parameters:
piMsgNum INTEGER
The ABL error message number
Returns CHARACTER
The file name containing the error message description
Top

PUBLIC CHARACTER GetMsgDescription (integer)

Purpose: Returns the error message description for the given ABL
error message
Notes: https://knowledgebase.progress.com/articles/Article/19758

Parameters:
piMsgNum INTEGER
The ABL error message number
Returns CHARACTER
The error message description
Top

PUBLIC CHARACTER GetRuntimeErrorMessage (integer)

Purpose: Returns the text of the given ABL error message
Notes: Parses the PROMSGS file

Parameters:
piMessageNumber INTEGER
The number of the error message to retrieve
Returns CHARACTER
The text of the error message
Top

PUBLIC CHARACTER GetSmartMessage (character)

Purpose: Formats a SmartMessage
Notes: This method is dependent on a Consultingwerk.SmartFramework.IMessageProvider
implementation registered in the ServiceContainer. When there is no
IMessageProvider implementation the vaue of pcSmartMessage will be
returned to the caller

Parameters:
pcSmartMessage CHARACTER
The smart message structure as returned by MessageFormatted class
Returns CHARACTER
The error message string as returned by the IMessageProvider
Top

PROTECTED LOGICAL HandleError (Error)

Purpose: Handles an Error object using the registered IErrorHandler
implementations
Notes: Logical return value indicates if the error has been completely
Handled, that is when this method returns TRUE, the ErrorHelper
will not display the error anymore, returns false when the
ErrorHelper should still display the error message dialog.

Parameters:
poError Progress.Lang.Error
The Error object to handle
Returns LOGICAL
Logical value indicating of the error has been completely handled by an IErrorHandler instance
Top

PUBLIC LOGICAL HasMessageNumber (Error, integer)

Purpose: Returns if the error instance contains an error message with the given
message number
Notes: Returns FALSE also when poError = ?

Parameters:
poError Progress.Lang.Error
The error instance to verify
piMessageNumber INTEGER
The message number to search for
Returns LOGICAL
Logical value indicating if the error contains a message with the given message number
Top

PUBLIC IgnoreError (Error, integer)

Purpose: Ignores specific Progress.Lang.SysErrors and throws all others
Notes:

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error instance to inspec
piErrorNum INTEGER
The SysError message number to ignore
Top

PUBLIC IgnoreError (Error, integer, integer)

Purpose: Ignores specific Progress.Lang.SysErrors and throws all others
Notes:

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error instance to inspec
piErrorNum1 INTEGER
The SysError message number to ignore
piErrorNum2 INTEGER
The SysError message number to ignore
Top

PUBLIC IgnoreError (Error, integer, integer, integer)

Purpose: Ignores specific Progress.Lang.SysErrors and throws all others
Notes:

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error instance to inspec
piErrorNum1 INTEGER
The SysError message number to ignore
piErrorNum2 INTEGER
The SysError message number to ignore
piErrorNum3 INTEGER
The SysError message number to ignore
Top

PUBLIC IgnoreError (Error, integer, integer, integer, integer)

Purpose: Ignores specific Progress.Lang.SysErrors and throws all others
Notes:

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error instance to inspec
piErrorNum1 INTEGER
The SysError message number to ignore
piErrorNum2 INTEGER
The SysError message number to ignore
piErrorNum3 INTEGER
The SysError message number to ignore
piErrorNum4 INTEGER
The SysError message number to ignore
Top

PUBLIC IgnoreError (Error, integer, integer, integer, integer, integer)

Purpose: Ignores specific Progress.Lang.SysErrors and throws all others
Notes:

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error instance to inspec
piErrorNum1 INTEGER
The SysError message number to ignore
piErrorNum2 INTEGER
The SysError message number to ignore
piErrorNum3 INTEGER
The SysError message number to ignore
piErrorNum4 INTEGER
The SysError message number to ignore
piErrorNum5 INTEGER
The SysError message number to ignore
Top

PUBLIC LOGICAL IsRemoteThrowable (Error)

Purpose: Returns if the error is throwable from an AppServer to an ABL client
Notes: Returns FALSE on OpenEdge 10.2B ... OpenEdge 11.3

Parameters:
poError Progress.Lang.Error
The Progress.Lang.Error instance to validate
Returns LOGICAL
Logical value indicating if the error can be thrown to the client
Top

PUBLIC Progress.Json.ObjectModel.JsonObject JsonErrorDetails (Error)

Purpose: Returns a Json Object with the error details
Notes: Processes inner errors if available

Parameters:
poError Progress.Lang.Error
The Error to parse
Returns Progress.Json.ObjectModel.JsonObject
The JsonObject describing the error
Top

PUBLIC Consultingwerk.Util.Error132Info ParseError132 (SysError)

Purpose: Parses an 132 runtime Error and returns the table and field/values
(** Salesrep already exists with Sales Rep "bbb". (132))
Notes:

Parameters:
poError Progress.Lang.SysError
The SysError to parse
Returns Consultingwerk.Util.Error132Info
The Error132Info with the details about the error
Top

PUBLIC RegisterErrorHandler (IErrorHandler)

Purpose: Registers a new IErrorHandler implementation
Notes:

Parameters:
poErrorHandler Consultingwerk.Framework.IErrorHandler
The reference to the IErrorHandler to register
Top

PUBLIC RegisterStopConditionHandler (IStopConditionHandler)

Purpose: Registers a new IStopConditionHandler implementation
Notes:

Parameters:
poStopConditionHandler Consultingwerk.Framework.IStopConditionHandler
The reference to the IStopConditionHandler to register
Top

PUBLIC ResetErrorStatus ()

Purpose: Resets the ERROR-STATUS:ERROR and ERROR-STATUS:NUM-MESSAGES etc.
Notes: Useful to wipe pending error stati and messages after executing ABL
code with NO-ERROR

Top

PROTECTED ShowDialog (Form, Form)

Purpose: Shows the dialog form
Notes:

Parameters:
poForm System.Windows.Forms.Form
The reference to the Dialog Form
poParentForm System.Windows.Forms.Form
The reference to the optional parent form
Top

PUBLIC ShowErrorMessage (Error)

Purpose: Display Error Message
Notes: Error Type (Class) will be used a default title

Parameters:
err Progress.Lang.Error
The Error object to visualize
Top

PUBLIC ShowErrorMessage (Error, character)

Purpose: Display Error Message
Notes: Stacktrack will be displayed when FrameworkSettings:DebugMode = TRUE

Parameters:
e Progress.Lang.Error
The Error object to visualize
pcTitle CHARACTER
The title for the message message (dialog)
Top

PUBLIC ShowErrorMessage (Error, character, Form)

Purpose: Display Error Message
Notes: Stacktrack will be displayed when FrameworkSettings:DebugMode = TRUE

Parameters:
e Progress.Lang.Error
The Error object to visualize
pcTitle CHARACTER
The title for the message message (dialog)
poParentForm System.Windows.Forms.Form
The ParentForm
Top

PUBLIC ShowErrorMessage (Error, Form)

Purpose: Display Error Message
Notes: Stacktrack will be displayed when FrameworkSettings:DebugMode = TRUE

Parameters:
e Progress.Lang.Error
The Error object to visualize
poParentForm System.Windows.Forms.Form
The ParentForm
Top

PUBLIC ShowErrorMessageBox (Error)

Purpose: Display Error Message as an alert-box (to be used in functions
and non-void methods due to WAIT-FOR limitations)
Notes: Error Type (Class) will be used a default title

Parameters:
e Progress.Lang.Error
The Error object to visualize
Top

PUBLIC ShowErrorMessageBox (Error, character)

Purpose: Display Error Message as an alert-box (to be used in functions
and non-void methods due to WAIT-FOR limitations)
Notes: Stacktrack will be displayed when FrameworkSettings:DebugMode = TRUE

Parameters:
e Progress.Lang.Error
The Error object to visualize
pcTitle CHARACTER
The title for the message message (dialog)
Top

PUBLIC CHARACTER StackTrace (Error)

Purpose: Reformats the Error Stack Trace (most current code block first,
not last as provided by the CallStack attribute
Notes:

Parameters:
e Progress.Lang.Error
The error object to return the formatted stacktrace for
Returns CHARACTER
The formatted stack trace


Constructor Detail
Top

PROTECTED ErrorHelper ()

Purpose: Protected default constructor.
Notes: There's no need to create instances of the helper classes



Property Detail
Top

PUBLIC CHARACTER CurrentStacktrace


Returns CHARACTER
Top

PUBLIC LOGICAL ErrorMessageDialogAllowed


Returns LOGICAL
Top

PUBLIC CHARACTER ErrorMessageFormType


Returns CHARACTER
Top

PUBLIC CHARACTER STOP_AFTER_MESSAGE


Returns CHARACTER
Top

PUBLIC CHARACTER STOP_LOCK_CONFLICT_MESSAGE


Returns CHARACTER
Top

PUBLIC CHARACTER STOP_MESSAGE


Returns CHARACTER
Top

PUBLIC CHARACTER STOP_USER_INTERRUPT_MESSAGE


Returns CHARACTER
Top

PUBLIC LOGICAL SuppressTableAndFieldInfo


Returns LOGICAL


©2006-2023 Consultingwerk Ltd.         info@consultingwerk.de         http://www.consultingwerk.de       15.04.2024 06:16:35