appwrite / appwrite/sdk-for-flutter

🚀 Feature: Constants for error Types

Open
#149 4 comments 1 reaction 1 assignee Claimed by @joeyouss View on GitHub
enhancement
Dominant language
Dart
Stars
418
Forks
150
Avg merge
1h 23m
Merged PRs (30d)
3

Description

### 🔖 Feature description

For the error types exposed [here](https://appwrite.io/docs/response-codes#errorTypes) we should have a class with constants or an enum so we don't have to manually put the string in the code.

### 🎤 Pitch

Let say I want to display some error message specifically to the user depending on the type, so instead of doing this:

```dart
AppWriteException exception;
if (exception.type == 'user_already_exists') {
...
}
```

I could use the constant instead
```dart
AppWriteException exception;

if (exception.type == ErrorType.userAlreadyExists) {
...
}
```

### 👀 Have you spent some time to check if this issue has been raised before?

- [X] I checked and didn't find similar issue

### 🏢 Have you read the Code of Conduct?

- [X] I have read the [Code of Conduct](https://github.com/appwrite/appwrite/blob/HEAD/CODE_OF_CONDUCT.md)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.