3
Guys, I have a C# code that has the code:
Uri resultadoURL;
bool resultado = Uri.TryCreate(Configuracoes.Configuracao.URL, UriKind.Absolute, out resultadoURL) && resultadoURL.Scheme == Uri.UriSchemeHttp;
if (!resultado)
throw new Exception(String.Format("URL '{0}' não é válida!", Configuracoes.Configuracao.URL));
On Try/catch, the ex. Message, instead of showing "URL 'xxx' is not valid", is showing the message "Message an exception was triggered by the destination of a call".
Block of Try/catch
catch (Exception ex)
{
try
{
Send(state.State, ToJson(new ResultadoDaIntegracao(false, ex.Message, null)));
}
catch { }
}
Does anyone know why the ex. Message comes different?
Wouldn’t your inner catch block be pq not propagating the Exception?
– Edgar Muniz Berlinck
Why do you throw a
Exception
and not a more specific exception? And why do you have atry
within acatch
? And the lattercatch
is just an example, right?– Maniero