Created more proper NotFound exceptions
This commit is contained in:
		| @@ -0,0 +1,10 @@ | ||||
| using Domains; | ||||
|  | ||||
| namespace Infrastructure.Database.GeneralExceptions | ||||
| { | ||||
|     /// Exception to throw when entity not found | ||||
|     /// <param name="id">Identifier of entity</param> | ||||
|     /// <typeparam name="T">Type of entity</typeparam> | ||||
|     public class EntityNotFoundByIdException<T>(Guid id) : EntityNotFoundException<T>($"Entity {typeof(T).Name} with id {id} not found.") | ||||
|         where T : class, IEntity; | ||||
| } | ||||
| @@ -2,8 +2,7 @@ | ||||
|  | ||||
| namespace Infrastructure.Database.GeneralExceptions; | ||||
|  | ||||
| /// Exception to throw when entity with specific id not found | ||||
| /// <param name="id">Identifier of entity</param> | ||||
| /// Exception to throw when entity not found | ||||
| /// <typeparam name="T">Not found entity type</typeparam> | ||||
| public class EntityNotFoundException<T>(Guid id) : Exception($"Entity {typeof(T).Name} with id '{id}' not found") | ||||
|     where T : class, IEntity; | ||||
| public class EntityNotFoundException<T>(string message) : Exception(message) | ||||
|     where T : class, IEntity; | ||||
|   | ||||
		Reference in New Issue
	
	Block a user