What you're looking for is the try/catch/finally construct. This allows you to capture an exception (error) and react to it.
Protected Function GetConnection() As SqlConnection
Dim ret_conn As SqlConnection
Try
ret_conn = New SqlConnection(System.Web.Configuration.WebConfigurationManager.ConnectionStrings("EUCNET00617").ToString())
ret_conn.Open()
GetConnection = ret_conn
Catch exceptionThatICaught as System.Exception
' You could also perform logging of details from exceptionThatICaught here
GetConnection = Null
End Try
End Function
Now, your GetConnection function will return Null when it's unable to create and open a connection, which means that the code that calls it can react to the connection returned being null, rather than crashing.
You might have noticed that the Exception that I put in the Catch block is System.Exception, ordinarily catching such a generic (all exceptions are derived from System.Exception) would be considered bad form, as it means you're trying to cater for anything that happens without being sure of what is happening. This is just an example to show you though =)
It's always worth reviewing the msdn documentation pages for the functions you're wrapping your try/catch around as some of them list "expected" (but not all) exceptions that may be thrown which you could consider catching, if you have a way of handling that failure case. In this instance, the pages to look at would be:
The documentation for SqlConnection.Open lists two exceptions that it can throw, InvalidOperationException and SqlException. I'd strongly recommend you review that documentation to make a decision as to "what to do" and "catch" whichever of those exception types you decide it's appropriate for you to do so.
conn = GetConnection() ... conn.Open() ... PerformDataPull() ... conn.Close(). Opening the connection where you have it is too easy to lead to the possibility of orphaned connections.