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

chore: add interface for all error response types #434

Merged
merged 2 commits into from
May 2, 2023
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
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDeleteResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public abstract class CacheDeleteResponse
public class Success : CacheDeleteResponse { }

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDeleteResponse
public class Error : CacheDeleteResponse, IError
{
private readonly SdkException _error;

Expand All @@ -43,19 +43,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doc inheritance 👍 😎

public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDictionaryFetchResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public class Miss : CacheDictionaryFetchResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionaryFetchResponse
public class Error : CacheDictionaryFetchResponse, IError
{
private readonly SdkException _error;

Expand All @@ -121,19 +121,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDictionaryGetFieldResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ public Miss(ByteString field) : base(field)
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionaryGetFieldResponse
public class Error : CacheDictionaryGetFieldResponse, IError
{
private readonly SdkException _error;

Expand All @@ -139,19 +139,19 @@ public Error(ByteString field, SdkException error) : base(field)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDictionaryGetFieldsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ public class Miss : CacheDictionaryGetFieldsResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionaryGetFieldsResponse
public class Error : CacheDictionaryGetFieldsResponse, IError
{
private readonly SdkException _error;

Expand All @@ -156,19 +156,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDictionaryIncrementResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override string ToString()
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionaryIncrementResponse
public class Error : CacheDictionaryIncrementResponse, IError
{
private readonly SdkException _error;

Expand All @@ -62,19 +62,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Success : CacheDictionaryRemoveFieldResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionaryRemoveFieldResponse
public class Error : CacheDictionaryRemoveFieldResponse, IError
{
private readonly SdkException _error;

Expand All @@ -45,19 +45,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Success : CacheDictionaryRemoveFieldsResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionaryRemoveFieldsResponse
public class Error : CacheDictionaryRemoveFieldsResponse, IError
{
private readonly SdkException _error;

Expand All @@ -45,19 +45,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDictionarySetFieldResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Success : CacheDictionarySetFieldResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionarySetFieldResponse
public class Error : CacheDictionarySetFieldResponse, IError
{
private readonly SdkException _error;

Expand All @@ -45,19 +45,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheDictionarySetFieldsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public class Success : CacheDictionarySetFieldsResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheDictionarySetFieldsResponse
public class Error : CacheDictionarySetFieldsResponse, IError
{
private readonly SdkException _error;

Expand All @@ -45,19 +45,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
2 changes: 1 addition & 1 deletion src/Momento.Sdk/Responses/CacheGetBatchResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public IEnumerable<byte[]?> ValueByteArrays
}
}

public class Error : CacheGetBatchResponse
public class Error : CacheGetBatchResponse, IError
{
private readonly SdkException _error;
public Error(SdkException error)
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheGetResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class Miss : CacheGetResponse
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheGetResponse
public class Error : CacheGetResponse, IError
{
private readonly SdkException _error;

Expand All @@ -95,19 +95,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheIncrementResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public override string ToString()
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheIncrementResponse
public class Error : CacheIncrementResponse, IError
{
private readonly SdkException _error;

Expand All @@ -62,19 +62,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
8 changes: 4 additions & 4 deletions src/Momento.Sdk/Responses/CacheKeyExistsResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public override string ToString()
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/description/*' />
public class Error : CacheKeyExistsResponse
public class Error : CacheKeyExistsResponse, IError
{
private readonly SdkException _error;

Expand All @@ -63,19 +63,19 @@ public Error(SdkException error)
_error = error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="InnerException"]/*' />
/// <inheritdoc />
public SdkException InnerException
{
get => _error;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="ErrorCode"]/*' />
/// <inheritdoc />
public MomentoErrorCode ErrorCode
{
get => _error.ErrorCode;
}

/// <include file="../docs.xml" path='docs/class[@name="Error"]/prop[@name="Message"]/*' />
/// <inheritdoc />
public string Message
{
get => $"{_error.MessageWrapper}: {_error.Message}";
Expand Down
Loading