|
2 | 2 | from aiohttp import ClientSession |
3 | 3 | import logging |
4 | 4 | from ..helpers.utils import extract_did, get_schema_details |
| 5 | +from .proof import ProofController |
5 | 6 |
|
6 | 7 | logger = logging.getLogger("aries_controller.issuer") |
7 | 8 |
|
@@ -126,13 +127,20 @@ async def send_request_for_record(self, cred_ex_id): |
126 | 127 |
|
127 | 128 | # Send holder a credential |
128 | 129 | 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 | + ) |
136 | 144 |
|
137 | 145 | # Store a received credential |
138 | 146 | async def store_credential(self, cred_ex_id, credential_id): |
|
0 commit comments