Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Code Block
titleException View Entity
linenumberstrue
VIEW_ENTITY Exception;
   _Type_       : STRING;  -- Either 'edmException' or 'xpxException'
   errCode      : INTEGER; -- EDM error code as returned from xpxExceptionId
   errMessage   : STRING;  -- EDM error message as returned from xpxExceptionId
   userCode     : INTEGER; -- Selfmade code
   userMessage  : STRING;  -- Selfmade message
   functionName : STRING;  -- Function as returned from xpxExceptionId or selfmade
   lineNumber   : INTEGER; -- Line number as returned from xpxExceptionId or selfmade.
   innerException : Exception;
END_VIEW_ENTITY;

The individual exception data is available in the xpxException object.

Code Block
titleExpress Helper functions and procedures
linenumberstrue
collapsetrue
-- Create an new innermost exception representing the current xpxExceptionId object
Function GetEDMException : Aggregate Of Exception; 
   GExceptions := [];
   CreateEDMException;
   Return(GExceptions);
End_Function;

Procedure NewEDMException;
   GExceptions := [];
   CreateEDMException;
End_Procedure;

-- Create an new "selfmade" innermost exception 
Function GetException(Message : String) : Aggregate Of Exception; 
   GExceptions := [];
   NewOuterException(Message);
   Return(GExceptions);
End_Function;

Procedure NewException(Message : String);
   GExceptions := [];
   NewOuterException(Message);
End_Procedure;

-- Create an new outer exception on the previous (inner) exception 
Function GetOuterException(Message : String) : Aggregate Of Exception; 
   NewOuterException(Message);
   Return(GExceptions);
End_Function;

Procedure NewOuterException(Message : String);
   Local
      lInnerException : Exception;
   End_Local;
   lInnerException := GException;
   New GException;
   GException._Type_         := 'xpxException';
   GException.userMessage    := Message;
   GException.innerException := lInnerException;
   GExceptions ++ GException;
End_Procedure;

Procedure CreateEDMException;
   Local
      lInnerException : Exception;
   End_Local;
   lInnerException := GException;
   New GException;
   GException._Type_       := 'edmException';
   GException.errCode      := xpxExceptionId.errCode;
   GException.errMessage   := xpxExceptionId.errMessage;
   GException.functionName := xpxExceptionId.functionName;
   GException.lineNumber   := xpxExceptionId.lineNumber;
   GException.innerException := lInnerException;
   GExceptions ++ GException;
End_procedure;

edmiNet

Code Block
languagevb
title.Net VB Example
linenumberstrue
Try
   EnterpriseModel.NewQuery.Execute("CatDictionaryServices", "UpdateExchangeRequirementConceptAttribute", New Object() {New Instance(ProductPage.ERConceptId),
                                                                                                                                     New Instance(lGroupId),
                                                                                                                                     New Instance(lConceptId),
                                                                                                                                     Column.Name, NewValue})
    RefreshRow = True
Catch XPXEx As XPXException
    XtraMessageBox.Show(XPXEx.Message)
Catch Ex As Exception
    XtraMessageBox.Show(Ex.ToString)
End Try
Code Block
languagec#
title.NET C# Example
linenumberstrue
try {
		EnterpriseModel.NewQuery.Execute("CatDictionaryServices", "UpdateExchangeRequirementConceptAttribute", new object[] {
			new Instance(ProductPage.ERConceptId),
			new Instance(lGroupId),
			new Instance(lConceptId),
			Column.Name,
			NewValue
		});
		RefreshRow = true;
} catch (XPXException XPXEx) {
		XtraMessageBox.Show(XPXEx.Message);
} catch (Exception Ex) {
		XtraMessageBox.Show(Ex.ToString);
}

If there is a usermessage in the xpxException object this will be shown as the Message of the exception object. If there is no usermessage and there is a edmErrroCode the message will look like this:

Code Block
titleExample output
Error number 11298: Illegal data type or data value of argument #1.
Function: xpfGetInstanceModel
Line number: 1581
Query function: CatDictionaryServices.UpdateExchangeRequirementConceptAttribute