1
0
mirror of https://github.com/bitwarden/server synced 2025-12-13 23:03:36 +00:00

Turn on file scoped namespaces (#2225)

This commit is contained in:
Justin Baur
2022-08-29 14:53:16 -04:00
committed by GitHub
parent 7c4521e0b4
commit 34fb4cca2a
1206 changed files with 73816 additions and 75022 deletions

View File

@@ -1,31 +1,30 @@
using Microsoft.AspNetCore.Mvc.ModelBinding;
namespace Bit.Core.Exceptions
namespace Bit.Core.Exceptions;
public class BadRequestException : Exception
{
public class BadRequestException : Exception
public BadRequestException(string message)
: base(message)
{ }
public BadRequestException(string key, string errorMessage)
: base("The model state is invalid.")
{
public BadRequestException(string message)
: base(message)
{ }
public BadRequestException(string key, string errorMessage)
: base("The model state is invalid.")
{
ModelState = new ModelStateDictionary();
ModelState.AddModelError(key, errorMessage);
}
public BadRequestException(ModelStateDictionary modelState)
: base("The model state is invalid.")
{
if (modelState.IsValid || modelState.ErrorCount == 0)
{
return;
}
ModelState = modelState;
}
public ModelStateDictionary ModelState { get; set; }
ModelState = new ModelStateDictionary();
ModelState.AddModelError(key, errorMessage);
}
public BadRequestException(ModelStateDictionary modelState)
: base("The model state is invalid.")
{
if (modelState.IsValid || modelState.ErrorCount == 0)
{
return;
}
ModelState = modelState;
}
public ModelStateDictionary ModelState { get; set; }
}