mirror of
https://github.com/Enzodtz/flutter-jwt-auth-template.git
synced 2025-08-06 16:19:47 +08:00
24 lines
491 B
Dart
24 lines
491 B
Dart
class FormFieldsException implements Exception {
|
|
final Map<String, dynamic> errors;
|
|
|
|
FormFieldsException({
|
|
required this.errors,
|
|
});
|
|
}
|
|
|
|
class FormGeneralException implements Exception {
|
|
final String message;
|
|
|
|
FormGeneralException({
|
|
required this.message,
|
|
});
|
|
}
|
|
|
|
Exception handleFormErrors(Map<String, dynamic> json) {
|
|
if (json['detail'] != null) {
|
|
return FormGeneralException(message: json['detail']);
|
|
} else {
|
|
return FormFieldsException(errors: json);
|
|
}
|
|
}
|