getContents method
- String chapterId
override
Implementation
@override
Future<LearningContentsDto> getContents(String chapterId) async {
try {
final result = await _client.getContentsGet(chapterId: chapterId);
final resultData = result.data;
if (resultData == null) {
throw RepositoryException(
RepositoryErrorType.notFound,
RepositoryErrorType.notFound.message,
);
}
final contents = resultData.map((e) => e).toList();
final convertedContents = _modelConvertManager.convertToContentsDto(
contents: contents,
);
return convertedContents;
} on RepositoryException catch (_) {
rethrow;
} on DioException catch (error, stackTrace) {
throw await _dioErrorHandler.handleDioError(
error,
stackTrace,
null,
);
} catch (error, stackTrace) {
throw _repositoryErrorHandler.handleUnknownError(error, stackTrace);
}
}