Best practices on exception handling in DataManager

Following your 'Load on demand' example at https://blazor.syncfusion.com/documentation/scheduler/data-binding?cs-save-lang=1&cs-lang=razor#load-on-demand

What is the best way to handle exceptions occurrring in database or network in DataManager?

SfScheduler

          DataManager

                       DataService

                                      -DbContext
                                      -API



1 Reply 1 reply marked as answer

SR Swathi Ravi Syncfusion Team November 29, 2024 05:36 AM UTC

Hi Yongkee,

 

Thank you for reaching out to us.

 

To handle exceptions effectively in scenarios involving the Scheduler and DataManager, we recommend the following approaches:

 

1: Client-Side Exception Handling:

 

The OnActionFailure event of the Scheduler will be triggered whenever exceptions occur during Scheduler operations (e.g., data retrieval or updates). You can use this event to handle errors gracefully on the client side and notify users if needed. For more details on this event, please refer to our Scheduler Events Documentation.

 

2: Server-Side Exception Handling:

 

On the server side, wrap your database or network operations in a try-catch block to catch and log exceptions. This ensures stability and helps in debugging issues related to DbContext or API communication. Additionally, you can return meaningful error messages to the client to provide further context when something goes wrong.

 

By implementing these measures, you can ensure robust exception handling in your application. If you need further assistance or have any additional questions, feel free to reach out.

 

 

Regards,

Swathi


Marked as answer
Loader.
Up arrow icon