Skip to content

Commit

Permalink
fix: Problem Report Before Exchange
Browse files Browse the repository at this point in the history
Signed-off-by: Rob Simpson <[email protected]>
  • Loading branch information
Rob Simpson authored and Rob Simpson committed Sep 27, 2023
1 parent f68914b commit 7283b43
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 23 deletions.
18 changes: 7 additions & 11 deletions aries_cloudagent/protocols/issue_credential/v1_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -668,8 +668,6 @@ async def credential_exchange_send_proposal(request: web.BaseRequest):

connection_record = None
cred_ex_record = None
credential_proposal = None
result = None
try:
preview = CredentialPreview.deserialize(preview_spec) if preview_spec else None
async with profile.session() as session:
Expand All @@ -695,12 +693,12 @@ async def credential_exchange_send_proposal(request: web.BaseRequest):
async with profile.session() as session:
await cred_ex_record.save_error_state(session, reason=err.roll_up)
# other party cannot yet receive a problem report about our failed protocol start
raise web.HTTPBadRequest(reason=err.roll_up)

else:
await outbound_handler(
credential_proposal,
connection_id=connection_id,
)
await outbound_handler(
credential_proposal,
connection_id=connection_id,
)

trace_event(
context.settings,
Expand Down Expand Up @@ -873,8 +871,6 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest):

cred_ex_record = None
connection_record = None
credential_offer_message = None
result = None
try:
async with profile.session() as session:
connection_record = await ConnRecord.retrieve_by_id(session, connection_id)
Expand Down Expand Up @@ -903,9 +899,9 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest):
async with profile.session() as session:
await cred_ex_record.save_error_state(session, reason=err.roll_up)
# other party cannot yet receive a problem report about our failed protocol start
raise web.HTTPBadRequest(reason=err.roll_up)

else:
await outbound_handler(credential_offer_message, connection_id=connection_id)
await outbound_handler(credential_offer_message, connection_id=connection_id)

trace_event(
context.settings,
Expand Down
18 changes: 6 additions & 12 deletions aries_cloudagent/protocols/issue_credential/v2_0/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -805,8 +805,6 @@ async def credential_exchange_send_proposal(request: web.BaseRequest):

conn_record = None
cred_ex_record = None
cred_proposal_message = None
result = None
try:
cred_preview = (
V20CredPreview.deserialize(preview_spec) if preview_spec else None
Expand Down Expand Up @@ -838,9 +836,9 @@ async def credential_exchange_send_proposal(request: web.BaseRequest):
async with profile.session() as session:
await cred_ex_record.save_error_state(session, reason=err.roll_up)
# other party cannot yet receive a problem report about our failed protocol start
raise web.HTTPBadRequest(reason=err.roll_up)

else:
await outbound_handler(cred_proposal_message, connection_id=connection_id)
await outbound_handler(cred_proposal_message, connection_id=connection_id)

trace_event(
context.settings,
Expand Down Expand Up @@ -1008,8 +1006,6 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest):

cred_ex_record = None
conn_record = None
cred_offer_message = None
result = None
try:
async with profile.session() as session:
conn_record = await ConnRecord.retrieve_by_id(session, connection_id)
Expand Down Expand Up @@ -1042,9 +1038,9 @@ async def credential_exchange_send_free_offer(request: web.BaseRequest):
async with profile.session() as session:
await cred_ex_record.save_error_state(session, reason=err.roll_up)
# other party cannot yet receive a problem report about our failed protocol start
raise web.HTTPBadRequest(reason=err.roll_up)

else:
await outbound_handler(cred_offer_message, connection_id=connection_id)
await outbound_handler(cred_offer_message, connection_id=connection_id)

trace_event(
context.settings,
Expand Down Expand Up @@ -1202,8 +1198,6 @@ async def credential_exchange_send_free_request(request: web.BaseRequest):

conn_record = None
cred_ex_record = None
cred_request_message = None
result = None
try:
try:
async with profile.session() as session:
Expand Down Expand Up @@ -1249,9 +1243,9 @@ async def credential_exchange_send_free_request(request: web.BaseRequest):
async with profile.session() as session:
await cred_ex_record.save_error_state(session, reason=err.roll_up)
# other party cannot yet receive a problem report about our failed protocol start
raise web.HTTPBadRequest(reason=err.roll_up)

else:
await outbound_handler(cred_request_message, connection_id=connection_id)
await outbound_handler(cred_request_message, connection_id=connection_id)

trace_event(
context.settings,
Expand Down

0 comments on commit 7283b43

Please sign in to comment.