Skip to content

Commit

Permalink
Cleanup error messages in ChannelError
Browse files Browse the repository at this point in the history
  • Loading branch information
romac committed Feb 17, 2022
1 parent 692026b commit d71ea62
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions relayer/src/channel/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,29 +60,29 @@ define_error! {
}
[ ForeignClientError ]
| e | {
format_args!("failed during an operation on client ({0}) hosted by chain ({1})",
format_args!("failed during an operation on client '{0}' hosted by chain '{1}'",
e.client_id, e.chain_id)
},

FetchSigner
{ chain_id: ChainId }
[ Error ]
|e| { format_args!("failed while fetching the signer for destination chain {}", e.chain_id) },
|e| { format_args!("failed while fetching the signer for destination chain '{}'", e.chain_id) },

Query
{ chain_id: ChainId }
[ Error ]
|e| { format_args!("failed during a query to chain id {0}", e.chain_id) },
|e| { format_args!("failed during a query to chain '{0}'", e.chain_id) },

QueryChannel
{ channel_id: ChannelId }
[ SupervisorError ]
|e| { format_args!("failed during a query to channel id {0}", e.channel_id) },
|e| { format_args!("failed during a query to channel '{0}'", e.channel_id) },

Submit
{ chain_id: ChainId }
[ Error ]
|_| { "failed during a transaction submission step to chain id {0}" },
|_| { "failed during a transaction submission step to chain '{0}'" },

HandshakeFinalize
{
Expand All @@ -92,7 +92,7 @@ define_error! {
}
[ Error ]
|e| {
format_args!("failed to finalize a channel open handshake while querying for channel end {0}/{1} on chain chain {2}",
format_args!("failed to finalize a channel open handshake while querying for channel end '{0}/{1}' on chain '{2}'",
e.port_id, e.channel_id, e.chain_id)
},

Expand All @@ -112,13 +112,13 @@ define_error! {
port_channel_id: PortChannelId,
}
| e | {
format_args!("channel {0} on chain {1} has no counterparty channel id",
format_args!("channel '{0}' on chain '{1}' has no counterparty channel id",
e.port_channel_id, e.chain_id)
},

ChannelAlreadyExist
{ channel_id: ChannelId }
|e| { format_args!("channel {} already exist in an incompatible state", e.channel_id) },
|e| { format_args!("channel '{}' already exist in an incompatible state", e.channel_id) },

MismatchChannelEnds
{
Expand All @@ -128,7 +128,7 @@ define_error! {
actual_counterrparty_port_channel_id: PortChannelId,
}
| e | {
format_args!("channel {0} on chain {1} expected to have counterparty {2} (but instead has {3})",
format_args!("channel '{0}' on chain '{1}' expected to have counterparty '{2}' but instead has '{3}'",
e.port_channel_id, e.chain_id,
e.expected_counterrparty_port_channel_id,
e.actual_counterrparty_port_channel_id)
Expand All @@ -143,18 +143,17 @@ define_error! {
counterparty_channel_id: ChannelId,
}
| e | {
format_args!("channel open try to chain `{}` and destination port `{}` does not match \
the source chain `{}` counterparty port `{}` for channel_id {}",
format_args!(
"channel open try to chain '{}' and destination port '{}' does not match \
the source chain '{}' counterparty port '{}' for channel '{}'",
e.destination_chain_id, e.destination_port_id,
e.source_chain_id,
e.counterparty_port_id,
e.counterparty_channel_id)
},

MissingEvent
{
description: String
}
{ description: String }
| e | {
format_args!("missing event: {}", e.description)
},
Expand Down

0 comments on commit d71ea62

Please sign in to comment.