findCommentById method
Returns a FindCommentResponse
for a comment with id commentId
Upon success a comment object is provided and error is set to null
In case of error a ResponseError
is set and no comment is provided
Implementation
@override
Future<FindCommentResponse> findCommentById(String commentId) {
return catchSqlError<FindCommentResponse>(
store.commentDao.findById(commentId).then((value) => value != null
? FindCommentResponse(comment: value)
: FindCommentResponse(
error: ResponseError.notFound(
message: 'Comment $commentId not found',
context: contextComment,
target: commentId))),
(sqle) => FindCommentResponse(
error: toResponseError(sqle,
context: contextComment, target: commentId)),
options);
}