Skip to content

Commit ef2d05c

Browse files
authored
Merge pull request #20 from didx-xyz/issue_18/prob_report_endpoints
2 parents 92a0d5d + d8e414c commit ef2d05c

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

aries_cloudcontroller/controllers/issuer.py

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,19 @@ async def send_request_for_record(self, cred_ex_id):
126126

127127
# Send holder a credential
128128
async def issue_credential(self, cred_ex_id, comment, attributes):
129-
body = {
130-
"comment": comment,
131-
"credential_preview": {"@type": CRED_PREVIEW, "attributes": attributes},
132-
}
133-
return await self.admin_POST(
134-
f"{self.base_url}/records/{cred_ex_id}/issue", json_data=body
135-
)
129+
try:
130+
body = {
131+
"comment": comment,
132+
"credential_preview": {"@type": CRED_PREVIEW, "attributes": attributes},
133+
}
134+
return await self.admin_POST(
135+
f"{self.base_url}/records/{cred_ex_id}/issue", json_data=body
136+
)
137+
except Exception as e:
138+
exc_msg = f"Could not issue credentials: {e!r}"
139+
logger.warn(exc_msg)
140+
self.send_problem_report(pres_ex_id=self.pres_ex_id, explanation=f"{e!r}")
141+
raise e(exc_msg)
136142

137143
# Store a received credential
138144
async def store_credential(self, cred_ex_id, credential_id: str = None):
@@ -161,7 +167,7 @@ async def remove_record(self, cred_ex_id):
161167
return await self.admin_DELETE(f"{self.base_url}/records/{cred_ex_id}")
162168

163169
# Send a problem report for a credential exchange
164-
async def problem_report(self, cred_ex_id, explanation: str):
170+
async def send_problem_report(self, cred_ex_id, explanation: str):
165171
body = {"explain_ltxt": explanation}
166172

167173
return await self.admin_POST(

aries_cloudcontroller/controllers/proof.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,9 +80,11 @@ async def get_presentation_credentials(
8080
)
8181

8282
# Send a problem report for presentation exchange
83-
async def send_problem_report(self, pres_ex_id, request):
83+
async def send_problem_report(self, pres_ex_id, explanation: str):
84+
body = {"explain_ltxt": explanation}
8485
return await self.admin_POST(
85-
f"{self.base_url}/records/{pres_ex_id}/problem-report", json_data=request
86+
f"{self.base_url}/records/{pres_ex_id}/problem-report",
87+
json_data=body,
8688
)
8789

8890
# Sends a proof presentation

0 commit comments

Comments
 (0)