Skip to content

Commit c2a706c

Browse files
Merge #432
432: tests: Fix get_client_stats_tests r=curquiza a=ahmednfwela # Pull Request ## Related issue Fixes #431 ## What does this PR do? - Introduce better error message logging ## PR checklist Please check if your PR fulfills the following requirements: - [ ] Does this PR fix an existing issue, or have you listed the changes applied in the PR description (and why they are needed)? - [ ] Have you read the contributing guidelines? - [ ] Have you made sure that the title is accurate and descriptive of the changes? Thank you so much for contributing to Meilisearch! <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Improved error messages for failed tasks by including detailed error information. * **Style** * Enhanced the display of task errors with a clearer string representation. <!-- end of auto-generated comment: release notes by coderabbit.ai --> Co-authored-by: ahmednfwela <afwela@inpro.sa>
2 parents 8088dac + f48692f commit c2a706c

File tree

2 files changed

+7
-2
lines changed

2 files changed

+7
-2
lines changed

lib/src/results/task_error.dart

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,9 @@ class TaskError {
1717
type: map['type'] as String?,
1818
link: map['link'] as String?,
1919
);
20+
21+
@override
22+
String toString() {
23+
return 'TaskError{message: $message, code: $code, type: $type, link: $link}';
24+
}
2025
}

test/utils/wait_for.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ extension TaskWaiter on Task {
1616
if (task.status != 'enqueued' && task.status != 'processing') {
1717
if (throwFailed && task.status != 'succeeded') {
1818
throw MeiliSearchApiException(
19-
"Task ($uid) failed",
19+
"Task ($uid) failed, error: ${task.error}",
2020
code: task.error?.code,
2121
link: task.error?.link,
2222
type: task.error?.type,
@@ -55,7 +55,7 @@ extension TaskWaiterForLists on Iterable<Task> {
5555
.firstWhereOrNull((element) => element.status != 'succeeded');
5656
if (failed != null) {
5757
throw MeiliSearchApiException(
58-
"Task (${failed.uid}) failed",
58+
"Task (${failed.uid}) failed, error: ${failed.error}",
5959
code: failed.error?.code,
6060
link: failed.error?.link,
6161
type: failed.error?.type,

0 commit comments

Comments
 (0)