restrepo 0.5.12

A collection of components for building restful webservices with actix-web
Documentation
//! Defines mapping from  service errors to service error codes.
//!    
//! ### Common Service Errors
//! | Error | Service Error Code |
//! |---|---|
//! | `Unexpected Error` | E0000 |
//! | [sqlx::Error] | E0001 |
//! | [serde_json::error::Error] | E0002 |
//! | [crate::persistence::RepositoryError]| E0003 |
//! | [anyhow::Error] | E0004 and E0005 |
//! | [crate::security::AuthorizationError] | E0006 |
//! | [crate::security::AccessForbiddenError] | E0007 |
//
//! ### Error cases of [sqlx::Error::Database]
//! | Postgres Error Code | Error Name | Serivce Error Code |
//! |---|---|---|
//! | Any   | generic database error | E0100 |                            
//! | 23000 | integrity_constraint_violation | E0101 |
//! | 23001 | restrict_violation | E0102 |
//! | 23502 | not_null_violation | E0103 |
//! | 23503 | foreign_key_violation | E0104 |
//! | 23505 | unique_violation | E0105 |
//! | 23514 | check_violation | E0106 |
//! | 23P01 | exclusion_violation | E0107 |

pub static AUTHORIZATION_ERROR: &str = "E0006";
pub static ACCESS_FORBIDDEN_ERROR: &str = "E0007";
pub static GENERIC_ERROR: &str = "E0000";
pub static NOT_FOUND_ERROR: &str = "E0001";
pub static DATA_FORMAT_ERROR: &str = "E0002";
pub static CONTOLLER_ERROR: &str = "E0004";
pub static PERSISTENCE_ERROR: &str = "E0003";
pub static SERVICE_ERROR: &str = "E0005";

pub static GENERIC_DB_ERROR: &str = "E0100";
pub static SCHEMA_VIOLATION_ERROR: &[(&str, &str)] = &[
    ("23000", "E0101"),
    ("23001", "E0102"),
    ("23502", "E0103"),
    ("23503", "E0104"),
    ("23505", "E0105"),
    ("23514", "E0106"),
    ("23P01", "E0107"),
];