sdk-for-flutter icon indicating copy to clipboard operation
sdk-for-flutter copied to clipboard

🚀 Feature: Constants for error Types

Open santigarcor opened this issue 1 year ago • 4 comments

🔖 Feature description

For the error types exposed here 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:

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

I could use the constant instead

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?

santigarcor avatar May 26 '23 02:05 santigarcor

Hi - thank you for opening this This really does sound helpful, keeping it open for gathering feedback.

joeyouss avatar May 29 '23 12:05 joeyouss

This is a really good idea. We'll be working on implementing this across all of our SDKs. Thank you for the suggestion @santigarcor!

eldadfux avatar May 29 '23 13:05 eldadfux

Is there anything I can do to help?

santigarcor avatar May 29 '23 14:05 santigarcor

Not sure yet, but if there will be we'll keep updates in this issue 👍

eldadfux avatar May 29 '23 15:05 eldadfux