A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://www.mongodb.com/docs/atlas/device-sdks/sdk/dotnet/sync/handle-sync-errors/ below:

Handle Sync Errors and Timeouts - .NET SDK - Atlas Device SDKs

Device Sync represents errors via SessionExceptions. In addition to the standard exception properties, you have access to an ErrorCode that contains information about the type of the error and allows you to have strongly typed handling logic.

config.OnSessionError = (session, sessionException) =>{    switch (sessionException.ErrorCode)    {                        case ErrorCode.BadQuery:            break;    }};
Note Additional Exception Information

For security reasons, App Services may send only a minimal amount of information about an exception, but the server-side logs will contain more details. In these cases, the HelpLink property on the exception contains a link to the associated log entry.

Tip

For a list of common Device Sync errors and how to handle them, refer to Sync Errors in the App Services Device Sync documentation.

To control which messages are logged by the client logger, use LogLevel:

Logger.LogLevel = LogLevel.Debug;
Tip

To diagnose and troubleshoot errors while developing your application, set the log level to debug or trace. For production deployments, decrease the log level for improved performance.

To set a custom logger function, set Logger.Default to a custom Logger function.

using Realms.Logging;Logger.LogLevel = LogLevel.All;Logger.Default = Logger.Function(message =>{    });

During Sync sessions, events may timeout without throwing an exception. You can set the CancelAsyncOperationsOnNonFatalErrors to true so that these events throw an exception that you can then handle. The following code shows an example of setting the CancelAsyncOperationsOnNonFatalErrors property, and 3 events that will throw an exception if they timeout:

var config = new FlexibleSyncConfiguration(app.CurrentUser!){    CancelAsyncOperationsOnNonFatalErrors = true,};var realm = await Realm.GetInstanceAsync(config);var session = realm.SyncSession;await session.WaitForUploadAsync();await session.WaitForDownloadAsync();

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4