TF-1115 Implement catch exception for HtmlDataSource

This commit is contained in:
dab246
2022-10-28 12:08:08 +07:00
committed by Dat H. Pham
parent d4187eec74
commit 48c1247dfe
5 changed files with 17 additions and 15 deletions
@@ -2,13 +2,15 @@ import 'package:core/core.dart';
import 'package:model/model.dart';
import 'package:tmail_ui_user/features/email/data/datasource/html_datasource.dart';
import 'package:tmail_ui_user/features/email/data/local/html_analyzer.dart';
import 'package:tmail_ui_user/main/exceptions/exception_thrower.dart';
class HtmlDataSourceImpl extends HtmlDataSource {
final HtmlAnalyzer _htmlAnalyzer;
final DioClient _dioClient;
final ExceptionThrower _exceptionThrower;
HtmlDataSourceImpl(this._htmlAnalyzer, this._dioClient);
HtmlDataSourceImpl(this._htmlAnalyzer, this._dioClient, this._exceptionThrower);
@override
Future<EmailContent> transformEmailContent(
@@ -18,7 +20,7 @@ class HtmlDataSourceImpl extends HtmlDataSource {
return Future.sync(() async {
return await _htmlAnalyzer.transformEmailContent(emailContent, mapUrlDownloadCID, _dioClient);
}).catchError((error) {
throw error;
_exceptionThrower.throwException(error);
});
}
@@ -27,7 +29,7 @@ class HtmlDataSourceImpl extends HtmlDataSource {
return Future.sync(() async {
return await _htmlAnalyzer.addTooltipWhenHoverOnLink(emailContent);
}).catchError((error) {
throw error;
_exceptionThrower.throwException(error);
});
}
}