Skip to content
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

Better error message for status response parsing #139

Merged
merged 2 commits into from
Feb 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/Agent/API.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 3 additions & 8 deletions src/Agent/Responses/StatusResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public class StatusResponse
/// The implementation may also return unversioned to indicate that it does not
/// comply to a particular version, e.g. in between releases.
/// </summary>
public string ICApiVersion { get; }
public string? ICApiVersion { get; }

/// <summary>
/// Optional. Identifies the implementation of the Internet Computer Protocol,
Expand Down Expand Up @@ -44,7 +44,7 @@ public class StatusResponse
/// </summary>
public byte[]? DevelopmentRootKey { get; }

/// <param name="icApiVersion">Identifies the interface version supported, i.e. the version of the present
/// <param name="icApiVersion">Optional. Identifies the interface version supported, i.e. the version of the present
/// document that the internet computer aims to support, e.g. `0.8.1`.
/// The implementation may also return unversioned to indicate that it does not
/// comply to a particular version, e.g. in between releases.</param>
Expand All @@ -61,7 +61,7 @@ public class StatusResponse
/// Internet Computer, agents must have an independent trustworthy source for this data,
/// and must not be tempted to fetch it from this insecure location</param>
public StatusResponse(
string icApiVersion,
string? icApiVersion,
string? implementationSource,
string? implementationVersion,
string? implementationRevision,
Expand Down Expand Up @@ -119,11 +119,6 @@ internal static StatusResponse ReadCbor(CborReader reader)

reader.ReadEndMap();

if (icApiVersion == null)
{
throw new CborContentException("Missing field: " + Properties.IC_API_VERSION);
}

return new StatusResponse(icApiVersion, implementationSource, implementationVersion, implementationRevision, developmentRootKey);
}

Expand Down