New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(agent): return non-200 status when > 0 failures in bulk op #4520
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
3 Ignored Deployments
|
Quality Gate passedIssues Measures |
continue; | ||
} | ||
const [outcome, params] = result.value; | ||
if (!isOk(outcome)) { | ||
failureCount += 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I recommend we save the outcome
here and use it to determine status.
++
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's possible that you get multiple different types of outcomes, should we just save the first one?
@@ -233,7 +233,7 @@ describe('Agent/$bulk-status', () => { | |||
.get('/fhir/R4/Agent/$bulk-status') | |||
.query({ name: 'Test Agent 2' }) | |||
.set('Authorization', 'Bearer ' + accessToken); | |||
expect(res.status).toBe(200); | |||
expect(res.status).toBe(500); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should never intentionally return a 500 - that should be reserved for unexpected errors.
@@ -132,7 +138,7 @@ export async function handleBulkAgentOperation( | |||
} | |||
|
|||
return [ | |||
allOk, | |||
failureCount === 0 ? allOk : serverError(new Error(`${failureCount} sub-operations failed`)), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use the saved outcome
here rather than serverError
See explanation #4513 (comment) |
No description provided.