-
Notifications
You must be signed in to change notification settings - Fork 198
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: improve sending error handling #1045
Merged
TimoGlastra
merged 4 commits into
openwallet-foundation:main
from
2060-io:feat/message-sending-error
Oct 6, 2022
Merged
Changes from 1 commit
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ca74456
feat(basic-messages): improve sending error handling
genaris f1c4d83
refactor: make associatedRecordId part of OutboundMessage
genaris df66ef8
refactor: remove unused parameter
genaris 76ea784
refactor: attach associatedRecord to outbound message
genaris File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,14 @@ | ||
import type { AgentMessage } from '../agent/AgentMessage' | ||
import type { BaseRecord } from '../storage/BaseRecord' | ||
import type { OutboundMessage } from '../types' | ||
|
||
import { AriesFrameworkError } from './AriesFrameworkError' | ||
|
||
export class MessageSendingError extends AriesFrameworkError { | ||
public agentMessage: AgentMessage | ||
public associatedRecord?: BaseRecord | ||
public outboundMessage: OutboundMessage | ||
public constructor( | ||
message: string, | ||
{ | ||
agentMessage, | ||
associatedRecord, | ||
cause, | ||
}: { agentMessage: AgentMessage; associatedRecord?: BaseRecord; cause?: Error } | ||
{ outboundMessage, cause }: { outboundMessage: OutboundMessage; associatedRecordId?: string; cause?: Error } | ||
) { | ||
super(message, { cause }) | ||
this.agentMessage = agentMessage | ||
this.associatedRecord = associatedRecord | ||
this.outboundMessage = outboundMessage | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adding the id but not the type can make it hard to get the record type in a generic context. A possibility is attachign the whole record, but I like the id appraoch better.. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was also hesitating on using the whole record or just the id. Opted to go for the id in order to make this whole outbound message more 'lightweight' and considering that the context would know the type of record to search for. But I don't have a very strong opinion on this. Can change to the whole record if we foresee that it's more convenient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah I think my preference would go to attaching the record