some fixes
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
import 'package:tm_app/core/network/app_exceptions.dart';
|
||||
|
||||
/// Utility class for handling error messages
|
||||
class ErrorUtils {
|
||||
/// Extracts a clean error message from an Exception
|
||||
static String getErrorMessage(Exception error) {
|
||||
if (error is AppException) {
|
||||
return error.message;
|
||||
}
|
||||
|
||||
// For plain Exception, remove "Exception: " prefix
|
||||
final errorString = error.toString();
|
||||
if (errorString.startsWith('Exception: ')) {
|
||||
return errorString.substring(11);
|
||||
}
|
||||
|
||||
return errorString;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user