Skip to content

Commit ae54c14

Browse files
committed
Merge remote-tracking branch 'origin/305-rest-api-error-handling' into 324-testing-ci
2 parents 0e7282c + 2679935 commit ae54c14

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

.github/workflows/build-test.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,9 @@ jobs:
4343
DOCKER_IMAGE_TAG=${{ github.sha }}
4444
echo "DOCKER_IMAGE_TAG=${DOCKER_IMAGE_TAG}" >> $GITHUB_ENV
4545
- name: Build ANMS
46-
run: ${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build --no-cache
46+
run: ${DOCKER_CMD} compose ${ANMS_COMPOSE_OPTS} build
4747
- name: Build Agents
48-
run: ${DOCKER_CMD} compose ${TESTENV_COMPOSE_OPTS} build --no-cache
48+
run: ${DOCKER_CMD} compose ${TESTENV_COMPOSE_OPTS} build
4949
- name: Build Volume
5050
run: |
5151
./create_volume.sh ./puppet/modules/apl_test/files/anms/tls

anms-core/anms/routes/transcoder.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,11 @@ def transcoder_put_str(input_ari: str):
170170

171171

172172
# PUT /ui/incoming_send/str Body is str ARI to send to transcoder
173-
@router.put("/ui/incoming_send/str", status_code=status.HTTP_200_OK)
173+
@router.put("/ui/incoming_send/str", status_code=status.HTTP_200_OK,
174+
responses={
175+
status.HTTP_500_INTERNAL_SERVER_ERROR: {"description" : "Error response from NM"},
176+
status.HTTP_504_GATEWAY_TIMEOUT: {"description" : "Manager response timed out"}
177+
})
174178
async def transcoder_send_ari_str(eid: str, ari: str):
175179
try:
176180
# Perform translation (API wrapper)
@@ -187,13 +191,13 @@ async def transcoder_send_ari_str(eid: str, ari: str):
187191
if info.parsed_as != "pending":
188192
break
189193
if retries <= 0:
190-
raise HTTPException(status_code=504,
194+
raise HTTPException(status_code=status.HTTP_504_GATEWAY_TIMEOUT,
191195
detail={ "idinfo" : idinfo, "info" : info, "status" : "transcoder timeout" })
192196

193197
retries -= 1
194198

195199
if info.parsed_as == "ERROR":
196-
raise HTTPException(status_code=500,
200+
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR,
197201
detail={ "idinfo" : idinfo, "info" : info, "status" : 500 })
198202

199203
# Publish
@@ -204,6 +208,7 @@ async def transcoder_send_ari_str(eid: str, ari: str):
204208
raise e
205209
except Exception as e:
206210
logger.exception(e)
207-
return status.HTTP_500_INTERNAL_SERVER_ERROR
211+
raise HTTPException(status_code=status.HTTP_500_INTERNAL_SERVER_ERROR)
212+
208213

209214

0 commit comments

Comments
 (0)