A Alex_197 Well-Known Member Licensed User Longtime User Jul 13, 2022 #1 Hi all. I just did a simple test - if I put my code into Try/Catch LastException shows me an error description but doesn't show a line number wher the error happens. If I run my code without Try/Catch it shows (in red in the log) exact line number, error description but the app crashes. My question is: Is it possible to see a line number where the error happenes when I'm using Try/Catch? The problem is that the error happens randomly, error message says someting about attempt to insert nil object from objects (similar to this https://www.b4x.com/android/forum/threads/solved-attempted-to-insert-nil-object-file-exists.104839/) and I'm trying to fugure out what causes this error. this is just an example where I played with try/catch B4X: Sub Button1_Click Try Dim a As Int a=2/"n" Log(a) Catch Log(LastException) End Try End Sub This is what I see in the log '<B4IExceptionWrapper: Error Domain=caught_exception Code=0 "java.lang.NumberFormatException: For input string: "n"" 'UserInfo={NSLocalizedDescription=java.lang.NumberFormatException: For input string: "n"}> If I run the same code without try / catch I see this Code: Application_Start Application_Active Error occurred on line: 39 (Main) java.lang.NumberFormatException: For input string: "n"
Hi all. I just did a simple test - if I put my code into Try/Catch LastException shows me an error description but doesn't show a line number wher the error happens. If I run my code without Try/Catch it shows (in red in the log) exact line number, error description but the app crashes. My question is: Is it possible to see a line number where the error happenes when I'm using Try/Catch? The problem is that the error happens randomly, error message says someting about attempt to insert nil object from objects (similar to this https://www.b4x.com/android/forum/threads/solved-attempted-to-insert-nil-object-file-exists.104839/) and I'm trying to fugure out what causes this error. this is just an example where I played with try/catch B4X: Sub Button1_Click Try Dim a As Int a=2/"n" Log(a) Catch Log(LastException) End Try End Sub This is what I see in the log '<B4IExceptionWrapper: Error Domain=caught_exception Code=0 "java.lang.NumberFormatException: For input string: "n"" 'UserInfo={NSLocalizedDescription=java.lang.NumberFormatException: For input string: "n"}> If I run the same code without try / catch I see this Code: Application_Start Application_Active Error occurred on line: 39 (Main) java.lang.NumberFormatException: For input string: "n"
Erel B4X founder Staff member Licensed User Longtime User Jul 13, 2022 #2 Alex_197 said: Is it possible to see a line number where the error happenes when I'm using Try/Catch? Click to expand... No. That information isn't available when you catch the exception. Upvote 0
Alex_197 said: Is it possible to see a line number where the error happenes when I'm using Try/Catch? Click to expand... No. That information isn't available when you catch the exception.