Hello

I have multiple procedures A, B, C, etc.

A calls B and B calls C.

I define error handlers in all my procedures as this:-

Public Sub A (Optional x As String)
On Error GoTo ErrHandler
    
Exit Sub
ErrHandler:
    MsgBox "FATAL ERROR in A!" & Chr(13) & Err.Number & ": " & Err.Description 
End Sub
Public Sub B (Optional x As String)
On Error GoTo ErrHandler
    
Exit Sub
ErrHandler:
    MsgBox "FATAL ERROR in B!" & Chr(13) & Err.Number & ": " & Err.Description 
End Sub
I was hoping that if there is an error in procedure B, i will get the message "FATAL ERROR in B!"

This will help me in quick debugging of errors.

But, it seems error gets propagated to calling procedure, and I always end up getting the error message defined in first procedure: "FATAL ERROR in A!"

Is there a way for error message to be returned from the procedure where the error occured?

Thanks
Ajay