¿Cómo tratar las excepciones en Java?
5 Octubre 2005
Es muy, sencillo:
[code lang="java"]
try
{
// [lots of code that accesses database thru helper functions...]
}
catch (Exception e)
{
if (e.Message ==
“Cannot insert duplicate key row in object ‘ProjectIDCode’ with unique ”
+ “index ‘adx_Projects_ProjectIDCode’.\r\n”
+ “Unexpected error inserting Profile.\r\n”
+ “The statement has been terminated.”)
{
lblError.Text =
“This code is already associated with another ”
+ “Project, please select another code.”;
return;
}
else
{
throw;
}
}
[/code]
Nos lo cuentan, como siempre, en WTF.
Actualización: Evidentemente, este post es sarcástico…


2 comentarios de “¿Cómo tratar las excepciones en Java?”
01
Bah, yo de ti no lo hubiera explicado. Si alguien se confundía ya se daría cuenta por sí mismo.
Cuñaaaaao
02
Por si acaso…
Al habla