How to get operation status of agent?

I am calling from LotusScript Java Agent, how to set status of the operation for NotesAgent.Run method when I get exception in Java agent?

I want to this code works:

If(agent.Run(doc.NoteID)<>0) Then

Messagebox "Greška u agentu: " & agent.Name & "." ,, "Greška"

	

Exit Sub

End If

Subject: How to get operation status of agent?

Why not pass the status to a certain field in your doc object and retrieve it when the java agent is done.