simplejrpc 0.1.0

Unix-socket JSON-RPC 2.0 SDK with middleware, config, and validation
Documentation
//! Client-facing error messages derived from **typed** [`crate::Error`] variants.
//!
//! Rust has no try/catch; the equivalent of custom exceptions is matching on
//! [`crate::Error`] / app-level error enums. Do **not** sniff message strings
//! to decide what to show to clients — use [`crate::error::Error::is_public`] /
//! [`crate::error::Error::client_message`] instead.
//!
//! # Examples
//!
//! ```
//! use simplejrpc::{sanitize::CLIENT_INTERNAL_MSG, Error, RpcCode};
//!
//! let internal = Error::Protocol("broken pipe".into());
//! assert!(!internal.is_public());
//! assert_eq!(internal.client_message(), CLIENT_INTERNAL_MSG);
//!
//! let biz = Error::biz(RpcCode::BadRequest, "name required");
//! assert!(biz.is_public());
//! assert_eq!(biz.client_message(), "name required");
//! ```

/// Default English fallback for internal failures (SQL, I/O, panic, …).
///
/// Used by [`crate::Error::client_message`] and panic recovery on the server so
/// stack traces / OS errors never leak into the RPC envelope `msg` field.
///
/// # Examples
///
/// ```
/// use simplejrpc::CLIENT_INTERNAL_MSG;
/// assert!(CLIENT_INTERNAL_MSG.contains("Internal"));
/// ```
pub const CLIENT_INTERNAL_MSG: &str = "Internal server error, please try again later";