public void HandleError(Exception ex, string additionalInfo = "") { var lastFmException = GetLastFmException(ex); switch (lastFmException.ErrorCode) { case ErrorCode.InvalidApiKey: case ErrorCode.ServiceOffline: case ErrorCode.ApiKeySuspended: case ErrorCode.RateLimitExceeded: _servicesStatus.SetStatus(WebServiceType.LastFm, false, GetUserFriendlyMessage(lastFmException.ErrorCode)); _errorHandler.Error(GetNewException(lastFmException, additionalInfo), GetUserFriendlyMessage(lastFmException.ErrorCode)); break; case ErrorCode.ConnectionFailed: _servicesStatus.SetStatus(WebServiceType.Web, false); _errorHandler.Warn(GetNewException(lastFmException, additionalInfo)); return; case ErrorCode.InvalidSessionKey: case ErrorCode.UnauthorizedToken: case ErrorCode.AuthenticationFailed: case ErrorCode.UserNotLoggedIn: // Change this to add a way of resolving session issues instead _servicesStatus.SetStatus(WebServiceType.LastFm, false, GetUserFriendlyMessage(lastFmException.ErrorCode)); _errorHandler.Error(GetNewException(lastFmException, additionalInfo), GetUserFriendlyMessage(lastFmException.ErrorCode)); break; default: _errorHandler.Warn(GetNewException(lastFmException, additionalInfo)); break; } }
private void Handle(WebServiceType type, ServiceUnavailableException ex, string additionalErrorInfo) { _servicesStatus.SetStatus(type, false, ex.Message); _errorHandler.Warn(new Exception(additionalErrorInfo, ex.InnerException)); }