From d52825d13487ee7b643d1d88b1baf49dfdfecb59 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 13:45:50 +0545 Subject: [PATCH] .net error handling --- docs/sdks/dotnet/GETTING_STARTED.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/sdks/dotnet/GETTING_STARTED.md b/docs/sdks/dotnet/GETTING_STARTED.md index 584d571a10..66dca9ff3f 100644 --- a/docs/sdks/dotnet/GETTING_STARTED.md +++ b/docs/sdks/dotnet/GETTING_STARTED.md @@ -28,6 +28,21 @@ static async Task Main(string[] args) } ``` +### Error Handling +The Appwrite .NET SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example. + +```csharp +var users = Users(client); + +try { + var request = await users.create('email@example.com', 'password', 'name'); + var response = await request.Content.ReadAsStringAsync(); + Console.WriteLine(response); +} catch (AppwriteException e) { + Console.WriteLine(e.Message); +} +``` + ### Learn more You can use followng resources to learn more and get help - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)