feat(app): refactoring of sentry using, feat(become_consultant): fixed possible infinite loading, feat(push_notifications): fixed push navigation from paid plan push

This commit is contained in:
misha
2026-04-07 10:05:11 +03:00
parent b6b13b1db5
commit aac085def4
133 changed files with 2344 additions and 2456 deletions

View File

@@ -0,0 +1,35 @@
import 'package:dio/dio.dart';
/// Сообщение для UI / аналитики при ошибке регистрации (вызывать из кубита).
String registrationErrorMessage(Object error) {
if (error is String) {
return error;
}
if (error is DioException && error.response?.statusCode == 422) {
final data = error.response?.data;
if (data is Map<String, dynamic>) {
var errorMsg = '';
if (data.containsKey('message')) {
errorMsg += '${data['message']}\n';
}
if (data.containsKey('errors')) {
final errors = data['errors'];
if (errors is Map) {
errors.forEach((key, value) {
if (value is List && value.isNotEmpty) {
errorMsg += '${value.join('\n')}\n';
}
});
}
}
if (errorMsg.isNotEmpty) {
return errorMsg.trim();
}
return 'Ошибка регистрации: $data';
}
}
if (error is DioException) {
return error.message ?? error.toString();
}
return error.toString();
}