#Event: RequestError(errorMessage as String)
'Add this new event annotation to the top of the class
Sub StartRequest(url as String) 'pass a URL at run-time
Dim hj as HttpJob
hj.Initialize("hj", Me)
Try
hj.Download(url)
Catch 'If the server doesn't respond, hj.Download will throw an Exception
CallSubDelayed2(cbObj, cbEN & "_RequestError", LastException.Message)
End Try
End Sub
Sub JobDone(Job as HttpJob)
If Not(Job.Success) Then 'Also raise the error event here
CallSubDelayed2(cbObj, cbEN & "_RequestError", Job.ErrorMessage)
Else
'Normal operation
End If
Job.Release
End Sub