A Standardized .NET library that captures the exceptions thrown by the EntityFramework from a Cosmos DB and converts them into meaningful exceptions...
This library was built according to The Standard. The library follows engineering principles, patterns and tooling as recommended by The Standard.
This library is also a community effort which involved many nights of pair-programming, test-driven development and in-depth exploration research and design discussions.
You can get STX.EFxceptions.Cosmos Nuget package by typing:
Install-Package STX.EFxceptions.Cosmos
You can get STX.EFxceptions.Identity.Cosmos Nuget package by typing:
Install-Package STX.EFxceptions.Identity.Cosmos
Replace your existing DbContext
class with EFxceptionsContext
(or your IdentityDbContext
with EFxceptionIdentityContext
) as follows:
public partial class StorageBroker : DbContext, IStorageBroker
{
public StorageBroker(DbContextOptions<StorageBroker> options)
: base(options) => this.Database.Migrate();
}
public partial class StorageBroker : EFxceptionsContext, IStorageBroker
{
public StorageBroker(DbContextOptions<StorageBroker> options)
: base(options) => this.Database.Migrate();
}
Code | Meanings | Exception |
---|---|---|
401 | Unauthorized: Access denied. | AuthenticationFailedException |
403 | Forbidden: No permission to access. | AuthorizationFailedException |
404 | Not Found: Resource does not exist. | ResourceNotFoundException |
408 | Request Timeout: Timed out waiting for response. | RequestTimeoutException |
409 | Conflict: Document with same key already exists. | DuplicateKeyException |
412 | Precondition Failed: Expected document condition not met. | PreconditionFailedException |
413 | Payload Too Large: Document exceeds size limit. | PayloadTooLargeException |
423 | Locked: Resource currently unavailable. | ResourceLockedException |
424 | Dependency Failed: Dependency unable to meet requirements. | DependencyFailedException |
429 | Too Many Requests: Rate limit exceeded. | TooManyRequestsException |
500 | Internal Server Error: Server encountered an unexpected condition. | InternalServerException |
503 | Service Unavailable: Server temporarily unable to handle request. | ServiceUnavailableException |
This library is forever growing as we add more exceptions and codes into it, we appreciate any contributions as there are so many codes we need to cover, so please stay tuned.
The most important fulfillment aspect in a Standard complaint system is aimed towards contributing to people, its evolution, and principles. An organization that systematically honors an environment of learning, training, and sharing knowledge is an organization that learns from the past, makes calculated risks for the future, and brings everyone within it up to speed on the current state of things as honestly, rapidly, and efficiently as possible.
We believe that everyone has the right to privacy, and will never do anything that could violate that right. We are committed to writing ethical and responsible software, and will always strive to use our skills, coding, and systems for the good. We believe that these beliefs will help to ensure that our software(s) are safe and secure and that it will never be used to harm or collect personal data for malicious purposes.
The Standard Community as a promise to you is in upholding these values.
If you have any suggestions, comments or questions, please feel free to contact me on:
A special thanks to Mr. Hassan Habib and Mr. Christo du Toit for their continuing dedicated contributions.