Skip to content

Commit ff27849

Browse files
Task not found while retrieving based on ID
1 parent a715da3 commit ff27849

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/main/mule/main-api.xml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,9 @@
177177
<set-variable value="400" doc:name="Set Status Code" doc:id="51fbd79f-5402-4a83-8ca3-b8680e3b81e0" variableName="httpStatus" />
178178
<set-variable value='#[vars.errorCustomType replace "UNKNOWN" with "MALFORMED_ID"]' doc:name="Update errorCustomType" doc:id="5049dfed-7516-4f02-b8b1-b273863b706b" variableName="errorCustomType"/>
179179
</when>
180+
<when expression='#[(vars.errorCustomType contains "NOT_FOUND")]'>
181+
<set-variable value="404" doc:name="Set Status Code" doc:id="b287636a-e58c-4f72-9bd4-311dd2428e3c" variableName="httpStatus" />
182+
</when>
180183
</choice>
181184
<ee:transform doc:name="Transform Message" doc:id="e7421cb1-862d-4dc7-bbee-e8ab29f998fe">
182185
<ee:message>

src/main/mule/tasks.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,13 @@ output application/json
162162
vars.task]]></ee:set-payload>
163163
</ee:message>
164164
</ee:transform>
165+
<choice doc:name="Choice" doc:id="1f06c664-36f2-43b1-a079-2eead1f7661b" >
166+
<when expression="#[vars.task == null]">
167+
<set-variable value="#['SALESFORCE_TASK_GET:NOT_FOUND']" doc:name="Set Custom Error Type" doc:id="bfbf2580-ded4-40b2-b4a6-13cd9aba7395" variableName="errorCustomType" />
168+
<set-variable value="The task with the given ID does not exist." doc:name="Set Custom Error Message" doc:id="68a345db-1898-4a73-bf7f-90cd763f2c2e" variableName="errorCustomMessage" />
169+
<raise-error doc:name="Raise error" doc:id="917b410d-1572-47d4-ab06-e7e3525a7f2b" type="CUSTOM:CUSTOM_ERROR" description="Something went wrong while retrieving the task record." />
170+
</when>
171+
</choice>
165172
<choice doc:name="Do we retrieve attendances?" doc:id="c3f4c5d9-605f-443c-a94e-ec85c809b45c" doc:description='When session is empty, but task type is "Take Attendance", we throw an error.' >
166173
<when expression='#[vars.task.TaskType == "Take Attendance"]' >
167174
<set-variable value="#[vars.task.Session]" doc:name="Set sessionId" doc:id="ca8c94e6-3b56-4e41-b929-64629b707e03" variableName="sessionId" />
@@ -189,7 +196,7 @@ vars.task]]></ee:set-payload>
189196
<when expression="#[isEmpty(vars.sessionDate)]" >
190197
<set-variable value="#['SALESFORCE_TASK_GET:BAD_REQUEST']" doc:name="Set Custom Error Type" doc:id="14384c39-deb4-4f66-b847-04b61e455036" variableName="errorCustomType" />
191198
<set-variable value="The given session doesn’t have a date or does not exist. Cannot proceed with creating a task and attendance records." doc:name="Set Custom Error Message" doc:id="d3132527-7cda-480d-b28d-3aa2fe12c502" variableName="errorCustomMessage" />
192-
<raise-error doc:name="Raise error" doc:id="fe77e915-6316-4296-bf94-dfb8b47eb37b" type="CUSTOM:CUSTOM_ERROR" description="Something went wrong while creating a task record." />
199+
<raise-error doc:name="Raise error" doc:id="fe77e915-6316-4296-bf94-dfb8b47eb37b" type="CUSTOM:CUSTOM_ERROR" description="Something went wrong while retrieving the task record." />
193200
</when>
194201
</choice>
195202
<flow-ref doc:name="Call `createAttendancesForSessionBasedOnTeamSeasonId`" doc:id="698c33b1-167a-446d-9db8-beac679f1b71" name="createAttendancesForSessionBasedOnTeamSeasonId" />

0 commit comments

Comments
 (0)