From 0e20eaac77d635877a1b8d5e3bc0e91765f5ecfa Mon Sep 17 00:00:00 2001 From: Damodar Lohani Date: Fri, 26 Mar 2021 18:20:18 +0545 Subject: [PATCH] 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)