Skip to content

Commit 1716f80

Browse files
committed
Address review feedback by:
* Including sending problem report when * issueing credentials fails
1 parent d556a41 commit 1716f80

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

aries_cloudcontroller/controllers/issuer.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
from aiohttp import ClientSession
33
import logging
44
from ..helpers.utils import extract_did, get_schema_details
5+
from .proof import ProofController
56

67
logger = logging.getLogger("aries_controller.issuer")
78

@@ -126,13 +127,20 @@ async def send_request_for_record(self, cred_ex_id):
126127

127128
# Send holder a credential
128129
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-
)
130+
try:
131+
body = {
132+
"comment": comment,
133+
"credential_preview": {"@type": CRED_PREVIEW, "attributes": attributes},
134+
}
135+
return await self.admin_POST(
136+
f"{self.base_url}/records/{cred_ex_id}/issue", json_data=body
137+
)
138+
except Exception as e:
139+
logger.warn(f"Could not issue credentials: {e!r}")
140+
ProofController = ProofController(self.admin_url, self.client_session)
141+
ProofController.send_problem_report(
142+
pres_ex_id=self.pres_ex_id, explanation=f"{e!r}"
143+
)
136144

137145
# Store a received credential
138146
async def store_credential(self, cred_ex_id, credential_id):

0 commit comments

Comments
 (0)