From 9c5db441049d18ecef35af869fc68ea8af71d972 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 13:01:14 +0545 Subject: [PATCH 1/9] dart error handling section --- docs/sdks/dart/GETTING_STARTED.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 7a5e8340d3..0a1909ea15 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -23,6 +23,21 @@ void main() async { } ``` +### Error handling +The Appwrite dart 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. + +```dart +Users users = Users(client); + +try { + final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); + print(response.data); +} on AppwriteException catch(e) { + //show message to user or do other operation based on error as required + print(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) From ca5911b4f1d74886eef2f643a2dacd578830015f Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 13:32:06 +0545 Subject: [PATCH 2/9] fix typo --- docs/sdks/dart/GETTING_STARTED.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/sdks/dart/GETTING_STARTED.md b/docs/sdks/dart/GETTING_STARTED.md index 0a1909ea15..56297a2e5e 100644 --- a/docs/sdks/dart/GETTING_STARTED.md +++ b/docs/sdks/dart/GETTING_STARTED.md @@ -24,7 +24,7 @@ void main() async { ``` ### Error handling -The Appwrite dart 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. +The Appwrite Dart 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. ```dart Users users = Users(client); From e25a632cfab5c9e14e62bd34f71f2b0dcbace3b1 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 13:41:57 +0545 Subject: [PATCH 3/9] deno error handling --- docs/sdks/deno/GETTING_STARTED.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/sdks/deno/GETTING_STARTED.md b/docs/sdks/deno/GETTING_STARTED.md index f0b10ed375..bfe40468b3 100644 --- a/docs/sdks/deno/GETTING_STARTED.md +++ b/docs/sdks/deno/GETTING_STARTED.md @@ -52,6 +52,19 @@ promise.then(function (response) { }); ``` +### Error Handling +The Appwrite Deno 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. + +```typescript +let users = new sdk.Users(client); + +try { + let res = await users.create('email@example.com', 'password'); +} catch(e) { + console.log(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) From d52825d13487ee7b643d1d88b1baf49dfdfecb59 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 13:45:50 +0545 Subject: [PATCH 4/9] .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) From d2e04720913067b3d02203395282718084ae1686 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 14:03:49 +0545 Subject: [PATCH 5/9] flutter error handling --- docs/sdks/flutter/GETTING_STARTED.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/docs/sdks/flutter/GETTING_STARTED.md b/docs/sdks/flutter/GETTING_STARTED.md index 9dae492f7f..78845f3e18 100644 --- a/docs/sdks/flutter/GETTING_STARTED.md +++ b/docs/sdks/flutter/GETTING_STARTED.md @@ -106,6 +106,21 @@ Response user = await account ); ``` +### Error Handling +The Appwrite Flutter 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. + +```dart +Users users = Users(client); + +try { + final response = await users.create(email: ‘email@example.com’,password: ‘password’, name: ‘name’); + print(response.data); +} on AppwriteException catch(e) { + //show message to user or do other operation based on error as required + print(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-flutter) From 447b21bd7e4840a3de167b471e46017bf86438ca Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 14:05:23 +0545 Subject: [PATCH 6/9] node sdk error handling --- docs/sdks/nodejs/GETTING_STARTED.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/sdks/nodejs/GETTING_STARTED.md b/docs/sdks/nodejs/GETTING_STARTED.md index af2564e212..1053f28142 100644 --- a/docs/sdks/nodejs/GETTING_STARTED.md +++ b/docs/sdks/nodejs/GETTING_STARTED.md @@ -52,6 +52,19 @@ promise.then(function (response) { }); ``` +### Error Handling +The Appwrite Node 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. + +```js +let users = new sdk.Users(client); + +try { + let res = await users.create('email@example.com', 'password'); +} catch(e) { + console.log(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) From 7db2ad922244caf9cafb014b3d355a4398d51e16 Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 14:19:47 +0545 Subject: [PATCH 7/9] php sdk error handling --- docs/sdks/php/GETTING_STARTED.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/sdks/php/GETTING_STARTED.md b/docs/sdks/php/GETTING_STARTED.md index 1fcfa35f65..b92bb90e93 100644 --- a/docs/sdks/php/GETTING_STARTED.md +++ b/docs/sdks/php/GETTING_STARTED.md @@ -40,6 +40,19 @@ $users = new Users($client); $result = $users->create('email@example.com', 'password'); ``` +### Error Handling +The Appwrite PHP 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. + +```php +$users = new Users($client); +try { + $result = $users->create('email@example.com', 'password'); +} catch(AppwriteException $error) { + echo $error->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) From d069e83b7973409f708a965f1e3cc39eaf81470b Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 14:22:57 +0545 Subject: [PATCH 8/9] python error handling --- docs/sdks/python/GETTING_STARTED.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/sdks/python/GETTING_STARTED.md b/docs/sdks/python/GETTING_STARTED.md index 6b16fa3a94..b513f01da8 100644 --- a/docs/sdks/python/GETTING_STARTED.md +++ b/docs/sdks/python/GETTING_STARTED.md @@ -43,6 +43,17 @@ users = Users(client) result = users.create('email@example.com', 'password') ``` +### Error Handling +The Appwrite Python 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. + +```python +users = Users(client) +try: + result = users.create('email@example.com', 'password') +except AppwriteException as e: + print(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) From 0e20eaac77d635877a1b8d5e3bc0e91765f5ecfa Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 18:20:18 +0545 Subject: [PATCH 9/9] ruby sdk exception handling section --- docs/sdks/ruby/GETTING_STARTED.md | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/docs/sdks/ruby/GETTING_STARTED.md b/docs/sdks/ruby/GETTING_STARTED.md index d353ee196a..23de47c1a3 100644 --- a/docs/sdks/ruby/GETTING_STARTED.md +++ b/docs/sdks/ruby/GETTING_STARTED.md @@ -41,6 +41,19 @@ users = Appwrite::Users.new(client); result = users.create(email: 'email@example.com', password: 'password'); ``` +### Error Handling +The Appwrite Ruby SDK raises `Appwrite::Exception` object with `message`, `code` and `response` properties. You can handle any errors by catching `Appwrite::Exception` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example. + +```ruby +users = Appwrite::Users.new(client); + +begin + result = users.create(email: 'email@example.com', password: 'password'); +rescue Appwrite::Exception => error + puts error.message +end +``` + ### Learn more You can use followng resources to learn more and get help - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-server)