Errorsys

General Help regarding HMG, Compilation, Linking, Samples

Moderator: Rathinagiri

Post Reply
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Errorsys

Post by AUGE_OHR »

hi,

if you have not a own Errorsys HMG will use c:\hmg.3.4.4\SOURCE\ErrorSys.prg

Code: Select all

   // add either filename or operation
   DO CASE
   CASE !Empty( oError:filename )
      cMessage += ": " + oError:filename
   CASE !Empty( oError:operation )
      cMessage += ": " + oError:operation
   ENDCASE
that´s why i talk about "missing" in Errorlog

so i have change it to

Code: Select all

   IF !Empty( oError:filename )
      cMessage += ": " + oError:filename
   ENDIF
   IF !Empty( oError:operation )
      cMessage += ": " + oError:operation
   ENDIF
and add "as much as possible Information"into Errorlog

but what i´m looking for are oError:Args

Xbase++

Code: Select all

   IF VALTYPE( oError::Args ) == "A"
      AEVAL( oError:Args, ;
             { | x, y | QOUT( SPACE( 9 ), "-> VALTYPE:", y := VALTYPE( x ) ), ;
             IIF( y == "O", QQOUT( " CLASS:", x:className() ), ;
             QQOUT( " VALUE:", Var2Char( x ) ) ) } )
  ENDIF              
FiveWin

Code: Select all

        if ValType( e:Args ) == "A"
            cErrorLog += "   Parameter   :" + CRLF
            for n = 1 to Len( e:Args )
                cErrorLog += "     [" + Str( n, 4 ) + "] = " + ValType( e:Args[ n ] ) + ;
                             "   " + cValToChar( e:Args[ n ] ) + CRLF
            next
        endif
so how with HMG and MiniGUI :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Errorsys

Post by AUGE_OHR »

hi,

have test it :D
Error_Args.jpg
Error_Args.jpg (57.88 KiB) Viewed 1548 times
it simple give me more Information from Error-Object

Code: Select all

   // add oError:Args
   if ValType( oError:Args ) == "A"              // Jimmy
       cMessage += "   Parameter   :" + CRLF
       FOR n = 1 to Len( oError:Args )
           cMessage += "     [" + Str( n, 4 ) + "] = " + ValType( oError:Args[ n ] ) + ;
                        "   " + hb_valToExp( oError:Args[ n ] ) + CRLF
       NEXT
   ENDIF
you can attach ERRORSYS.PRG in your *.HBP or replace Original c:\hmg.3.4.4\SOURCE\ErrorSys.PRG (re-build LIB)
Attachments
HB_ERRORSYS.ZIP
(2.96 KiB) Downloaded 127 times
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Errorsys

Post by AUGE_OHR »

hi,

it seems to work stable with new Errorsys but i have to re-compile Debugger with new Errorsys else it does not start ...

the Function hb_valToExp() is working fine but when have a big Array it might exceed Screen hight ...
so we need a Version which limit "Array -Dump" ... perhaps only 1st Element :idea:

---

this is a "General" Version but my "own" Version will have "more" Information.
what do you think to include to help find Error with Errorlog :idea:
have fun
Jimmy
User avatar
AUGE_OHR
Posts: 2060
Joined: Sun Aug 25, 2019 3:12 pm
DBs Used: DBF, PostgreSQL, MySQL, SQLite
Location: Hamburg, Germany

Re: Errorsys

Post by AUGE_OHR »

hi,

i have try to enhance Error Message

Code: Select all

       FOR n = 1 to Len( oError:Args )
           cMessage += "     [" + Str( n, 4 ) + "] = " + ValType( oError:Args[ n ] ) + ;
                        "   " + CheckTypeLen( oError:Args[ n ] ) + CRLF
       NEXT

Code: Select all

Function CheckTypeLen(uVal)
local cType := ValType( uVal )
   do case
      case cType == "C" .or. cType == "M"
         return uVal
      case cType == "D"
         return DToC( uVal )
      case cType == "L"
         return If( uVal, ".T.", ".F." )
      case cType == "N"
         return AllTrim( Str( uVal ) )
      case cType == "B"
         return hb_valToExp( uVal )
      case cType == "A"
*        return "{ "+ hb_valToExp(uVal[1]) +" ... }"
         return "{ ... }"
      case cType == "O"
         return If( __ObjHasData( uVal, "cClassName" ), uVal:cClassName, uVal:ClassName() )
      otherwise
         return hb_valToExp(uVal)
   endcase
return nil
it is Type "A" where i like to get more Information ... but not "too much"

Question : which other Type for harbour / HMG are missing :idea:

my 1st try fail and give a recursive Error with [1] when have a EMPTY() Array ... that i have oversee :roll:
next Try

Code: Select all

   case cType == "A"
      IF EMPTY(uVal)
         return "{}"
      ELSE
         return "{ "+ LTRIM(STR(LEN(uVal))) +" }"
      ENDIF
when get a Array Error most it is
Error BASE/1132 Bound error array access
so the LEN() of Array is the Problem.
but if have a big Array using hb_valToExp( uVal ) it is "too much" Information ... just need (active) LEN()

new Error Message look like this

Code: Select all

Parameter : [ 1] = A { 9 } [ 2] = N 10 
is it clear what Error say :?:
have fun
Jimmy
Post Reply