Android Question Warning #25

Robert Valentino

Well-Known Member
Licensed User
Longtime User
I have routines in my Library Code that if an Error occurs checks if there is a ErrorMsg Routine and if so calls it. But because these routines are not available when compiling the library I get a ton of Warning #25 messages that are really helpful

B4X:
    Try
         ... ' Some Code
    Catch
         If  SubExists(mCallRoutine, "ErrorMsg") Then
             CallSubDelayed3(mCallRoutine, "ErrorMsg", LastException.Message, "Work Routine Name")
         End If  
    End Try

The above code generates warning #25 in my code because "ErrorMsg" does not exist.

I do not want to do a blanket #IgnoreWarnings: 25 because that might hide something that could be a problem

Is there someway to do something like this

B4X:
    Try
         ... ' Some Code
    Catch  
         #IgnoreWarnings: Push 25
         If  SubExists(mCallRoutine, "ErrorMsg") Then
             CallSubDelayed3(mCallRoutine, "ErrorMsg", LastException.Message, "Work Routine Name")
         End If  
         #IgnoreWarnings: Pop 25
     End Try

This way the Warning 25 will only be ignored around that group of code?

BobVal
 

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Well I found a quick work around.

Added a routine name that matches the call (even - but will never be called in the library_

Not Pretty but gets rid of the messages

B4X:
Private Sub ErrorMsg(Exception As String, WorkerRoutine As String)
             
End Sub
 
Upvote 0

Robert Valentino

Well-Known Member
Licensed User
Longtime User
Guess I should have waited before posting and dug deeper.

Found Erel's comment about 'ignore

B4X:
Try
         ... ' Some Code
    Catch
         If  SubExists(mCallRoutine, "ErrorMsg") Then
             CallSubDelayed3(mCallRoutine, "ErrorMsg", LastException.Message, "Work Routine Name")  'ignore this warning
         End If
     End Try

SORRY for all the posts on this. A little quick on the trigger - will watch that
 
Upvote 0
Top