@@ -126,13 +126,19 @@ async def send_request_for_record(self, cred_ex_id):
126
126
127
127
# Send holder a credential
128
128
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 )
136
142
137
143
# Store a received credential
138
144
async def store_credential (self , cred_ex_id , credential_id : str = None ):
@@ -161,7 +167,7 @@ async def remove_record(self, cred_ex_id):
161
167
return await self .admin_DELETE (f"{ self .base_url } /records/{ cred_ex_id } " )
162
168
163
169
# 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 ):
165
171
body = {"explain_ltxt" : explanation }
166
172
167
173
return await self .admin_POST (
0 commit comments