I have a method in my Webservice that throws an exception if the code of the card is already in use, ie when trying to release the access the system checks if it is already in use and returns the Exception
. >
Code in Webservice
...
try
{
if(ListaCartoes.Any(c => c.Codigo == cartaoParaAcesso)
throw new Exception("CARTÃO JÁ ESTÁ EM USO");
}
catch(Exception ex)
{
throw new ErroLiberacaoDeAcesso(ex.message);
}
Customer Code
...
try
{
Webservice.LiberaAcesso(informacoesAcesso);
}
catch(Exception ex)
{
MessageBox.Show(ex.message);
}
Code class Error AccessLibrary:
[Serializable()]
public class ErroLiberaAcesso: Exception
{
public ErroLiberaAcesso() : base()
{ }
public ErroLiberaAcesso(string message) : base(message)
{ }
public ErroLiberaAcesso(string message, Exception innerException) : base(message, innerException)
{ }
protected ErroLiberaAcesso(SerializationInfo info, StreamingContext context) : base(info, context)
{ }
}
Error that is returning:
---exception = {"System.Web.Services.Protocols.SoapException: The server was unable to process the request." -> Pca_Webservice_V2.AccessRecovery: CARD NUMBER IN USE \ n
That is, it is not just the "NUMBER OF CARD IN USE" message that is returning. What can I do in this case?