-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Handle mosque not found error in API and update mosque manager (#…
…1162) * feat: Handle mosque not found error in API and update mosque manager - 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. * reformat
- Loading branch information
1 parent
b080b88
commit 86835e8
Showing
3 changed files
with
40 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
abstract class MosqueFailure implements Exception { | ||
final String errorMessage; | ||
final String errorCode; | ||
|
||
const MosqueFailure({ | ||
required this.errorMessage, | ||
required this.errorCode, | ||
}); | ||
} | ||
|
||
class MosqueNotFoundFailure extends MosqueFailure { | ||
const MosqueNotFoundFailure() | ||
: super( | ||
errorMessage: 'Mosque not found', | ||
errorCode: 'MOSQUE_IS_NOT_FOUND', | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters