#Is AppwriteException thrown everytime?

3 messages · Page 1 of 1 (latest)

runic prism
#

I'm trying to make sure my code handles exceptions properly. I saw that people kept getting the AppwriteException whenever something went wrong.

My question is if I can just catch AppwriteException for every function?

static Future<models.Account> createAccount(String email, String password) async {
    try {
      return await account.create(userId: ID.unique(), email: email, password: password);
    } on AppwriteException catch (e) {
      Get.snackbar('Error!', e.message.toString());
      rethrow;
    }
  }

This is what I'm doing right now in Flutter. Would this work for any other function of the appwrite sdk?

somber needle
runic prism
#

That's amazing how you found these things so quickly!
Thanks for the help @somber needle