chappy83 _+_+_+_ | J'ai un probléme avec les exception suivante:
Code :
- private string getSSID()
- {
- string ssid = null;
- try
- {
- //int index = User.Identity.Name.IndexOf(@"\" );
- //ssid = User.Identity.Name.Substring(++index);
- if (ssid == null || ssid == string.Empty)
- {
- //throw new SsidException("You are not authenticaded" );
- throw new SsidException("You are not authenticaded" );
- }
- }
- catch (SsidException ssidex)
- {
- StringBuilder message = new System.Text.StringBuilder();
- MultiView1.SetActiveView(View3);
- message.AppendFormat("#{0}", ssidex.Message);
- lbDSIDError.Text = message.ToString();
- //return null;
- }
- return ssid;
-
- }
|
Code :
- private Employee_R_C GetEmployee(string currentUser)
- {
- try
- {
- Employee_R_RC obj = Employee_R_RC.GetEmployee_R_RC(currentUser);
- Employee_R_C objChild = obj[0];
- return objChild;
- }
- catch (SsidException nrex)
- {
- StringBuilder message = new System.Text.StringBuilder();
- MultiView1.SetActiveView(View3);
- message.AppendFormat("#{0}", nrex.Message);
- lbDSIDError.Text = message.ToString();
- return null;
- }
- catch (Csla.DataPortalException dpex)
- {
- StringBuilder message = new System.Text.StringBuilder();
- MultiView1.SetActiveView(View3);
- message.AppendFormat("##{0} - {1}", dpex.Message, currentUser);
- lbDSIDError.Text = message.ToString();
- return null;
- }
- catch (ArgumentOutOfRangeException ex)
- {
- StringBuilder message = new System.Text.StringBuilder();
- MultiView1.SetActiveView(View3);
- message.AppendFormat("###{0} - {1}", ex.Message, currentUser);
- lbDSIDError.Text = message.ToString();
- return null;
- }
- catch (Exception nrex)
- {
- StringBuilder message = new System.Text.StringBuilder();
- MultiView1.SetActiveView(View3);
- message.AppendFormat("####{0} - {1}", nrex.Message, currentUser);
- lbDSIDError.Text = message.ToString();
- return null;
- }
-
- }
|
Code :
- public class SsidException : Exception
- {
- public SsidException(string message):base(message)
- {
- }
- }
|
Moi qui pensait que mon SsidException soit trigé je me tropme c'est toujours le dataportal excpetion, c'est normal. Mia normalement si je trow mon exception et que dans le cathc je le récetionne, pourque l'application ne s'arette pas et rentre dans GetEmployee ???
Code :
- String SSID = getSSID();
- Employee_R_C obj = GetEmployee(SSID);
|
|