B4J Question How to catch this error

marcick

Well-Known Member
Licensed User
Longtime User
Hi all,
I have a B4J server app that sometime capture an error in the main thread, but I can't discover where it is generated.

I have this code in main thread:

B4X:
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Dim TextWriter1 As TextWriter
    TextWriter1.Initialize(File.OpenOutput(File.DirApp, "AppError.log",True))
    Dim er As StringBuilder
    er.Initialize
    Dim dt As String=Mysub.mydate(DateTime.Now, "yyyy-MM-dd HH:mm:ss")
       If srvr.CurrentThreadIndex = 0 Then 'main thread
        LogError(StackTrace)   
        er.Append(dt & " App Error 1: " & Error & CRLF)
        er.Append(Error & CRLF)
        er.Append(StackTrace & CRLF & CRLF & CRLF & CRLF)
        TextWriter1.Write(er.ToString)
        TextWriter1.Close
        Return False
      Else 'handlers threads
        Log(dt & " App Error 2: " & Error)
        er.Append(dt & " App Error 2: " & Error & CRLF)
        er.Append(Error & CRLF)
        er.Append(StackTrace & CRLF & CRLF & CRLF & CRLF)
        TextWriter1.Write(er.ToString)
        TextWriter1.Close
        Return True
       End If
End Sub

But in the text file I read only these info:

2020-12-04 16:16:36 App Error 1: (FileNotFoundException) java.io.FileNotFoundException: C:\Users\ADMINI~1\AppData\Local\Temp\2\32372 (The system cannot find the file specified)

Any hints how to debug it ?
 

Daestrum

Expert
Licensed User
Longtime User
Is the file it is looking for uploaded to the server ?

If the file is incomplete (upload not finished) then I believe windows won't allow access to it.
 
Upvote 0

marcick

Well-Known Member
Licensed User
Longtime User
May be. Not sure. I would like to see where it is generated to discorver how to fix it
 
Last edited:
Upvote 0
Top