refactor: improve error message handling in profile settings and add width constraints to agent tag chips
This commit is contained in:
@@ -6,6 +6,7 @@ import 'package:flutter/services.dart';
|
||||
import 'package:flutter_riverpod/flutter_riverpod.dart';
|
||||
import 'package:image_picker/image_picker.dart';
|
||||
import 'package:real_estate_mobile/core/constants/app_colors.dart';
|
||||
import 'package:real_estate_mobile/core/network/api_exceptions.dart';
|
||||
import 'package:real_estate_mobile/core/utils/image_url_resolver.dart';
|
||||
import 'package:real_estate_mobile/core/widgets/s3_image.dart';
|
||||
import 'package:real_estate_mobile/features/profile/data/profile_repository.dart';
|
||||
@@ -500,7 +501,12 @@ class _ChangeEmailSheetState extends State<_ChangeEmailSheet> {
|
||||
if (!mounted) return;
|
||||
setState(() {
|
||||
_submitting = false;
|
||||
_localError = e.toString().replaceFirst('Exception: ', '');
|
||||
// ApiException carries the backend's message verbatim
|
||||
// (e.g. "Incorrect password", "Email is already in use").
|
||||
// Fall back to a generic message for unexpected error types.
|
||||
_localError = e is ApiException
|
||||
? e.message
|
||||
: 'Something went wrong. Please try again.';
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user