yeatmanlab / roar-dashboard

A dashboard to administer ROAR assessments
https://roar.education
Other
4 stars 4 forks source link

Fix error handling in `fetchDocById` helper #867

Closed maximilianoertel closed 5 days ago

maximilianoertel commented 5 days ago

Proposed changes

This PR removes the swallowErrors parameter on the fetchByDocId helper to, well, prevent errors from being swallowed. Doing so and allowing the helper to throw any errors, enables any TanStack query using this helper function to properly handle error cases and trigger automatic retries.

As this parameter was only used in the validateCode method, this PR also slightly refactors that function to handle thrown errors.

Types of changes

Checklist

Justification of missing checklist items

n/a

Further comments

n/a

Ref https://github.com/yeatmanlab/roar/issues/318

github-actions[bot] commented 5 days ago

Coverage Report

Status Category Percentage Covered / Total
šŸ”µ Lines 5.1% 390 / 7637
šŸ”µ Statements 4.99% 421 / 8423
šŸ”µ Functions 6.13% 115 / 1876
šŸ”µ Branches 2.41% 110 / 4563
File Coverage
File Stmts % Branch % Funcs % Lines Uncovered Lines
Changed Files
src/components/auth/RegisterStudent.vue 0% 0% 0% 0% 345-347, 349-353, 355, 360-361, 363-365, 364, 367-369, 368, 371-372, 374-399, 401-425, 428-451, 450, 454-458, 455-457, 456, 461-466, 462-465, 463-464, 470-471, 475-480, 476, 478-479, 483, 486, 488-528, 489, 491-496, 492-495, 498-506, 499-504, 501-503, 502, 505, 508, 510-513, 511-512, 515-527, 517-526, 518-524, 519-523, 525, 530-558, 532, 532, 534-557, 535, 537-543, 538-542, 545, 547-552, 548, 550-551, 554, 556, 560-572, 561, 563, 563, 565-569, 566, 568, 568, 571, 574-586, 575, 577, 577, 579-583, 580, 582, 582, 585, 588-604, 606-610, 612-619, 621, 623-628, 630-633, 635-638, 640-643, 646-667, 669, 671-682, 672-680, 673-679, 675-678, 681, 2-3, 6-7, 9, 16, 1, 49, 54-55, 64-65, 80, 84, 105, 127, 130, 132, 134, 160, 176, 178, 190, 194, 196, 207, 209-210, 220-221, 231, 233-234, 244-245, 255, 257-258, 268-269, 279, 281-282, 294, 305, 313, 1-11, 1-21, 32, 60, 1-68, 1-89, 1-115, 1-133, 1-139, 1-148, 1-165, 1-180, 1-191, 1-198, 1-212, 1-223, 1-236, 1-247, 1-260, 1-271, 1-284, 298, 308, 318, 1-321
src/helpers/query/utils.js 9.44% 0% 0% 10.43% 18-38, 29-37, 30-37, 32-37, 34, 34-37, 36, 36, 42-58, 44-54, 45-52, 51, 53, 55, 59, 59, 59, 70-72, 76-78, 90-92, 91, 100-102, 101, 104, 108-112, 114-120, 140-141, 143-148, 144-147, 150-152, 152-153, 155, 157-161, 160, 176-178, 178, 180-182, 184-186, 185, 188, 190-203, 191, 195-202, 201, 210-213, 211-212, 214-215, 217-230, 218-219, 219-229, 223-227, 226, 231, 235-237, 236, 239-241, 241-267, 250-266, 252-262, 253-261, 259, 263, 269, 269, 269, 269, 283, 285-286, 286-287, 289-307, 293-300, 295-298, 297, 303-306
Generated in workflow #654 for commit 1522135 by the Vitest Coverage Report Action
github-actions[bot] commented 5 days ago

Visit the preview URL for this PR (updated for commit 1522135):

https://roar-staging--pr867-ref-318-query-compos-t79uux7m.web.app

(expires Thu, 17 Oct 2024 22:02:25 GMT)

šŸ”„ via Firebase Hosting GitHub Action šŸŒŽ

Sign: 2631e9c58fd0104ecbfddd72a62245ddac467460

cypress[bot] commented 5 days ago

roar-dashboard-e2e    Run #8171

Run Properties:  status check passed Passed #8171  •  git commit 1522135dc8: Component Tests for PR 867 "Fix error handling in `fetchDocById` helper" from co...
Project roar-dashboard-e2e
Run status status check passed Passed #8171
Run duration 02m 01s
Commit git commit 1522135dc8: Component Tests for PR 867 "Fix error handling in `fetchDocById` helper" from co...
Committer Maximilian Oertel
View all properties for this run ā†—ļøŽ

Test results
Tests that failed  Failures 0
Tests that were flaky  Flaky 0
Tests that did not run due to a developer annotating a test with .skip  Pending 0
Tests that did not run due to a failure in a mocha hook  Skipped 0
Tests that passed  Passing 17