/// <summary> /// Converts a network exception into a user friendly error message. /// </summary> static string GetErrorMessage(Exception exception) { Trace.WriteLine(string.Format("Network operation threw {0}: {1}", exception, exception.Message)); // Is this a GamerPrivilegeException? if (exception is GamerPrivilegeException) { return(Resources.ErrorGamerPrivilege); } // Is it a NetworkSessionJoinException? NetworkSessionJoinException joinException = exception as NetworkSessionJoinException; if (joinException != null) { switch (joinException.JoinError) { case NetworkSessionJoinError.SessionFull: return(Resources.ErrorSessionFull); case NetworkSessionJoinError.SessionNotFound: return(Resources.ErrorSessionNotFound); case NetworkSessionJoinError.SessionNotJoinable: return(Resources.ErrorSessionNotJoinable); } } // Otherwise just a generic error message. return(Resources.ErrorNetwork); }
/// <summary> /// Converts a network exception into a user friendly error message. /// </summary> static string GetErrorMessage(Exception exception) { // // Trace.WriteLine("Network operation threw " + exception); // Is this a GamerPrivilegeException? if (exception is GamerPrivilegeException) { if (Guide.IsTrialMode) { return(Resources.ErrorTrialMode); } else { return(Resources.ErrorGamerPrivilege); } } // Is it a NetworkSessionJoinException? NetworkSessionJoinException joinException = exception as NetworkSessionJoinException; if (joinException != null) { switch (joinException.JoinError) { case NetworkSessionJoinError.SessionFull: return(Resources.ErrorSessionFull); case NetworkSessionJoinError.SessionNotFound: return(Resources.ErrorSessionNotFound); case NetworkSessionJoinError.SessionNotJoinable: return(Resources.ErrorSessionNotJoinable); } } // Is this a NetworkNotAvailableException? if (exception is NetworkNotAvailableException) { return(Resources.ErrorNetworkNotAvailable); } // Is this a NetworkException? if (exception is NetworkException) { return(Resources.ErrorNetwork); } // Otherwise just a generic error message. // return Resources.ErrorUnknown; return(exception.Message); }
/// <summary> /// Converts a network exception into a user friendly error message. /// </summary> static string GetErrorMessage(Exception exception) { Trace.WriteLine("Network operation threw " + exception); // Is this a GamerPrivilegeException? if (exception is GamerPrivilegeException) { if (Guide.IsTrialMode) { return("Trial Mode"); } else { return("Full Mode"); } } // Is it a NetworkSessionJoinException? NetworkSessionJoinException joinException = exception as NetworkSessionJoinException; if (joinException != null) { switch (joinException.JoinError) { case NetworkSessionJoinError.SessionFull: return("Session Full"); case NetworkSessionJoinError.SessionNotFound: return("Session Not Found"); case NetworkSessionJoinError.SessionNotJoinable: return("Session Cant Join"); } } // Is this a NetworkNotAvailableException? if (exception is NetworkNotAvailableException) { return("Network Not Avaliable"); } // Is this a NetworkException? if (exception is NetworkException) { return("Network Not Avaliable"); } // Otherwise just a generic error message. return("Network Not Avaliable"); }