Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Handle mosque not found error in API and update mosque manager #1162

Merged
merged 3 commits into from
Jul 11, 2024

Conversation

YassinNouh21
Copy link
Contributor

📝 Summary

This PR addresses the issue where if the UID of a mosque is not found, the user should be removed or kicked out without an error in the application.

Description

  • Added MosqueFailure and MosqueNotFoundFailure classes to handle specific mosque-related errors.
  • Updated Api.dart to catch Dio 404 errors and throw MosqueNotFoundFailure.
  • Modified mosque_manager.dart to handle MosqueFailure errors specifically. If a MosqueNotFoundFailure is encountered, the user is removed from the mosque without throwing an error, ensuring a smooth user experience.

Tests

🧪 Use case 1

image


💬 Description:
When attempting to fetch a mosque by UID that does not exist, the application should catch the error, remove the user from the mosque context, and notify listeners without displaying an error message.

📷 Screenshots or GIFs (if applicable):
N/A

Checklist:

  • Coding Standards: I have reviewed my code to ensure it follows the project's coding standards.
  • Testing: I have tested the changes and they work as expected.
  • Merge Conflicts: I have resolved any merge conflicts with the latest main/development branch.
  • Branch Status: The branch is up-to-date with the target branch (main/development).

- Added `MosqueFailure` and `MosqueNotFoundFailure` classes to handle specific mosque-related errors.
- Updated `Api.dart` to catch Dio 404 errors and throw `MosqueNotFoundFailure`.
- Modified `mosque_manager.dart` to handle `MosqueFailure` errors specifically and update state accordingly.
@YassinNouh21 YassinNouh21 force-pushed the fix/1159-dioexception-dioexception branch from 80a0035 to f192403 Compare May 29, 2024 19:01
Copy link
Contributor

@ghassenbenzahra123 ghassenbenzahra123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ibrahim-zehhaf-mawaqit
Copy link
Contributor

resolve conflict

@ghassenbenzahra123 ghassenbenzahra123 merged commit 86835e8 into main Jul 11, 2024
1 check passed
@ghassenbenzahra123 ghassenbenzahra123 deleted the fix/1159-dioexception-dioexception branch July 11, 2024 16:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants