Alaska Software Inc. - raise errors
Username: Password:
AuthorTopic: raise errors
Claudio Driussi raise errors
on Mon, 13 Jun 2022 13:16:54 +0200
Hi everybody

There is a way to rase an error in Xbase++

Thanks in advance

Claudio
Thomas BraunRe: raise errors
on Wed, 15 Jun 2022 08:59:32 +0200
Claudio Driussi wrote:

> Hi everybody
> 
> There is a way to rase an error in Xbase++
> 
> Thanks in advance
> 
> Claudio

Yes, basically you create an error object, populate the attributes and call
the current errorblock...

This is part of some errorhandling inside one of my programs:

   IF EOF() .OR. VAL(EVENTS->evid) != VAL(cEvid)

      lRet := .F.
      IF !lSilent
         oError := Error():New()
         oError:args := {cEvid, EVENTS->evid,
LTRIM(STR(EVENTS->(recno())))+"/"+LTRIM(STR(EVENTS->(lastrec()))), IIF(
EVENTS->(EOF()), "EOF()", "not EOF()")}
         oError:candefault := .F.
         oError:canretry := .F.
         oError:cansubstitute := .F.
         oError:Description := "Error locating event record"
         oError:GenCode := 0
         oError:SubCode := 0
         oError:SubSystem := ""
         oError:operation := "LocateEventRecord()"
         oError:severity := XPP_ES_ERROR
         oError:Thread := ThreadID()
         Eval(ErrorBlock, oError)
      ENDIF
   ENDIF

HTH
Thomas
Claudio Driussi Re: raise errors
on Thu, 16 Jun 2022 12:13:46 +0200
Many thanks Thomas.

Il 15/06/22 08:59, Thomas Braun ha scritto:
> Claudio Driussi wrote:
> 
>> Hi everybody
>>
>> There is a way to rase an error in Xbase++
>>
>> Thanks in advance
>>
>> Claudio
> 
> Yes, basically you create an error object, populate the attributes and call
> the current errorblock...
> 
> This is part of some errorhandling inside one of my programs:
> 
>     IF EOF() .OR. VAL(EVENTS->evid) != VAL(cEvid)
> 
>        lRet := .F.
>        IF !lSilent
>           oError := Error():New()
>           oError:args := {cEvid, EVENTS->evid,
> LTRIM(STR(EVENTS->(recno())))+"/"+LTRIM(STR(EVENTS->(lastrec()))), IIF(
> EVENTS->(EOF()), "EOF()", "not EOF()")}
>           oError:candefault := .F.
>           oError:canretry := .F.
>           oError:cansubstitute := .F.
>           oError:Description := "Error locating event record"
>           oError:GenCode := 0
>           oError:SubCode := 0
>           oError:SubSystem := ""
>           oError:operation := "LocateEventRecord()"
>           oError:severity := XPP_ES_ERROR
>           oError:Thread := ThreadID()
>           Eval(ErrorBlock, oError)
>        ENDIF
>     ENDIF
> 
> HTH
> Thomas