Skip to content

Commit

Permalink
log errors to identify problem with url loading in get-entity
Browse files Browse the repository at this point in the history
Signed-off-by: David Hernando <[email protected]>
  • Loading branch information
davidatwhiletrue committed Jul 12, 2024
1 parent f1c5601 commit a335d4a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
2 changes: 1 addition & 1 deletion Docs/Demos/NCTLWebExplorer/Pages/BlockDetail.razor
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ else
}
else
{
<b><a href="/get-entity/@(_block.Proposer)">@_block.Proposer.PublicKey.FormatPublicKey()</a></b>
<b><a href="/get-entity/@(_block.Proposer.PublicKey.ToString())">@_block.Proposer.PublicKey.FormatPublicKey()</a></b>
}
</div>
</div>
Expand Down
8 changes: 8 additions & 0 deletions Docs/Demos/NCTLWebExplorer/Pages/GetEntity.razor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ public enum AccountInfoMethod

public partial class GetEntity
{
[Inject] protected ILogger<GetEntity> Logger { get; set; }

[Parameter] public string AccountPublicKey { get; set; }

private int _queryMethod;
Expand Down Expand Up @@ -54,6 +56,7 @@ async Task GetEntityBtnClicked()
if (key == null ||
(key is not IEntityIdentifier))
{
Logger.LogError($"Cannot convert '{EntityAddress}' to entity identifier. key: '{key}'");
ErrorMessage = "Wrong entity identifier value or format.";
return;
}
Expand All @@ -69,10 +72,12 @@ async Task GetEntityBtnClicked()
}
catch (RpcClientException e)
{
Logger.LogError($"RPC Error getting entity: {e.Message} - {e.Data}'");
ErrorMessage = e.Message + ".\n" + e.Data;
}
catch (Exception e)
{
Logger.LogError($"Error getting entity: {e.Message}'");
ErrorMessage = "Wrong entity identifier value or format.";
}
}
Expand All @@ -83,6 +88,7 @@ async Task GetEntityBtnClicked()
if (key == null ||
(key is not PublicKey && key is not AccountHashKey))
{
Logger.LogError($"Cannot convert '{EntityAddress}' to public key or account hash. key: '{key}'");
ErrorMessage = "Wrong entity identifier value or format.";
return;
}
Expand All @@ -104,10 +110,12 @@ async Task GetEntityBtnClicked()
}
catch (RpcClientException e)
{
Logger.LogError($"RPC Error getting account info: {e.Message} - {e.Data}'");
ErrorMessage = e.Message + ".\n" + e.Data;
}
catch (Exception e)
{
Logger.LogError($"Error getting account info: {e.Message}'");
ErrorMessage = "Wrong entity identifier value or format.";
}
}
Expand Down

0 comments on commit a335d4a

Please sign in to comment.