On error...

Creative ideas/suggestions for HMG

Moderator: Rathinagiri

User avatar
Rathinagiri
Posts: 5471
Joined: Tue Jul 29, 2008 6:30 pm
DBs Used: MariaDB, SQLite, SQLCipher and MySQL
Location: Sivakasi, India
Contact:

Re: On error...

Post by Rathinagiri »

61 years! Great!

With immense happy I salute you sir!
East or West HMG is the Best.
South or North HMG is worth.
...the possibilities are endless.
Dilip Patel
Posts: 31
Joined: Tue Aug 17, 2010 6:01 am

Re: On error...

Post by Dilip Patel »

Hi Rathi,
Thank you. I have great admiration for you. You have been doing a splendid job for the community (HMG) and I salute YOU.
Regards,
Dilip
User avatar
esgici
Posts: 4543
Joined: Wed Jul 30, 2008 9:17 pm
DBs Used: DBF
Location: iskenderun / Turkiye
Contact:

Re: On error...

Post by esgici »

Hi Dilip
Dilip Patel wrote:I am 61 years old.
You are welcome to oldies club 8-)

Long live ! I'm the oldest member yet :mrgreen:
Dilip Patel wrote:The truncation of the variable name is as a result of Harbour writing only 10 characters...
In fact, Clipper and Harbour allows long identifiers. The 10 characters limit come from old dBase era.
Dilip Patel wrote:... no other way of knowing or obtaining the stored variables in memory.
Be patient a little more, please. My work is almost finised.
Dilip Patel wrote:...Thanks to HMG and Harbour to date no crashes. Wonderfull sets of programs.
You are welcome to wonderland :D

Viva Harbour, viva HMG !

Regards

--

Esgici
Viva INTERNATIONAL HMG :D
Dilip Patel
Posts: 31
Joined: Tue Aug 17, 2010 6:01 am

Re: On error...

Post by Dilip Patel »

Hi Esgici,
Being OLD, with us patience is a virtue. Am awaiting to see the results of your work!
Regards,
Dilip
User avatar
koke
Posts: 116
Joined: Wed Aug 21, 2013 3:54 pm
DBs Used: DBF, mySql, mariaDB

Re: On error...

Post by koke »

Hola, esto fue muy útil, así que una pequeña contribución al código dado por esgici solo para guardar el resultado del error en un archivo para que el programa pueda cerrarse y aún así puedas saber el error. Gracias.

Hi, these was very helpful, so a little contribution to the code given by esgici just to save the error result to a file so the program can be closed and you can still know the error from it. Thank you

Code: Select all

PROCEDURE SimpleErrorHandler( oCurrentError  )  // Simple Error handle procedure

   LOCAL cErrDetail   :=  '',;
         cFileAsc2Err := IF( EMPTY( oCurrentError:filename ), "None", oCurrentError:filename ),;
		 errortraido := ""

		errortraido := errortraido + "A Run Time Errror Occured :" + CRLF + CRLF
        errortraido := errortraido + "Error " 
        errortraido := errortraido + oCurrentError:subSystem +'/'                  // BASE
        errortraido := errortraido + LTRIM( STR( oCurrentError:subCode ) ) + ": " // 1003
        errortraido := errortraido + oCurrentError:operation                           // xVaribleUnExist
        errortraido := errortraido + CRLF + CRLF 
        errortraido := errortraido + "R.T.Error" + CRLF
		errortraido := errortraido + CallSequence() + CRLF + CRLF
        errortraido := errortraido + "Can Substitute ? " + IF( oCurrentError:canSubstitute, "Yes", "No" ) + CRLF 
        errortraido := errortraido + "Can Retry ? "      + IF( oCurrentError:canRetry,      "Yes", "No" ) + CRLF 
        errortraido := errortraido + "Can Default ? "    + IF( oCurrentError:canDefault,    "Yes", "No" ) + CRLF
        errortraido := errortraido + "Op. Sys. Err. Code : " + LTRIM( STR( oCurrentError:osCode ) )  + CRLF 
        errortraido := errortraido + "Generic Error Code : " + LTRIM( STR( oCurrentError:genCode ) ) + CRLF
        errortraido := errortraido + "Associated File : "    + cFileAsc2Err  + CRLF
        errortraido := errortraido + "Severity : " + LTRIM( STR( oCurrentError:severity  ) )
		nombrearch := "errorlog.log"

    If (nManejalog := fcreate(nombrearch,0)) == -1
		MsgBox("No se puede crear el fichero:", FERROR())
		Return
	Else
		fwrite(nManejalog,errortraido)
		FCLOSE(nManejalog)
		FCLOSE(nManejalog)
	EndIf
RETURN
,___,
[O.o]
/)__)
-”–”-
KoKe
Post Reply