A little bit about splitting and using parentheses will help you a lot here:
let download (url : string) =
use webClient = new WebClient()
try
webClient.DownloadString(url)
with
| :? WebException as ex when (ex.Response :? HttpWebResponse) ->
use response = ex.Response :?> HttpWebResponse
use data = response.GetResponseStream()
use reader = new StreamReader(data)
let text = reader.ReadToEnd()
failwith (response.StatusCode.ToString() + ": " + text)
This function compiles and works as expected.
, , , when ( , when it), .
failwith, , .