mirror of
https://github.com/bitwarden/server.git
synced 2025-07-19 00:21:35 -05:00
Partial<T> for CommandResult<T> (#5482)
* Example of how a partial success/failure command result would look. * Fixed code. * Added Validator and ValidationResult * Moved errors into their own files. * Fixing tests * fixed import. * Forgot mock error.
This commit is contained in:
3
src/Core/AdminConsole/Errors/Error.cs
Normal file
3
src/Core/AdminConsole/Errors/Error.cs
Normal file
@ -0,0 +1,3 @@
|
||||
namespace Bit.Core.AdminConsole.Errors;
|
||||
|
||||
public record Error<T>(string Message, T ErroredValue);
|
11
src/Core/AdminConsole/Errors/InsufficientPermissionsError.cs
Normal file
11
src/Core/AdminConsole/Errors/InsufficientPermissionsError.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Bit.Core.AdminConsole.Errors;
|
||||
|
||||
public record InsufficientPermissionsError<T>(string Message, T ErroredValue) : Error<T>(Message, ErroredValue)
|
||||
{
|
||||
public const string Code = "Insufficient Permissions";
|
||||
|
||||
public InsufficientPermissionsError(T ErroredValue) : this(Code, ErroredValue)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
11
src/Core/AdminConsole/Errors/RecordNotFoundError.cs
Normal file
11
src/Core/AdminConsole/Errors/RecordNotFoundError.cs
Normal file
@ -0,0 +1,11 @@
|
||||
namespace Bit.Core.AdminConsole.Errors;
|
||||
|
||||
public record RecordNotFoundError<T>(string Message, T ErroredValue) : Error<T>(Message, ErroredValue)
|
||||
{
|
||||
public const string Code = "Record Not Found";
|
||||
|
||||
public RecordNotFoundError(T ErroredValue) : this(Code, ErroredValue)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user