TF-3707 Show error description from JMAP response if possible

Signed-off-by: dab246 <tdvu@linagora.com>
This commit is contained in:
dab246
2025-05-07 10:59:48 +07:00
committed by Dat H. Pham
parent 71362070e5
commit 099ac3846f
2 changed files with 39 additions and 3 deletions
@@ -0,0 +1,12 @@
import 'package:jmap_dart_client/jmap/core/error/method/error_method_response.dart';
import 'package:jmap_dart_client/jmap/core/error/method/exception/error_method_response_exception.dart';
extension ErrorMethodResponseExceptionExtension on ErrorMethodResponseException {
String get errorMessage {
if (errorResponse is ErrorMethodResponse) {
return (errorResponse as ErrorMethodResponse).description?.trim() ?? '';
}
return '';
}
}