Skip to content

Commit 7783452

Browse files
committed
Use AppResult alias in docs
1 parent e0b932e commit 7783452

File tree

5 files changed

+11
-11
lines changed

5 files changed

+11
-11
lines changed

src/convert.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,9 +46,9 @@
4646
//! ```rust
4747
//! use std::io::{self, ErrorKind};
4848
//!
49-
//! use masterror::{AppError, AppErrorKind};
49+
//! use masterror::{AppError, AppErrorKind, AppResult};
5050
//!
51-
//! fn open() -> Result<(), AppError> {
51+
//! fn open() -> AppResult<()> {
5252
//! let _ = io::Error::new(ErrorKind::Other, "boom");
5353
//! Err(io::Error::from(ErrorKind::Other).into())
5454
//! }
@@ -61,9 +61,9 @@
6161
//! feature):
6262
//!
6363
//! ```rust
64-
//! use masterror::{AppError, AppErrorKind};
64+
//! use masterror::{AppError, AppErrorKind, AppResult};
6565
//!
66-
//! fn validate(x: i32) -> Result<(), AppError> {
66+
//! fn validate(x: i32) -> AppResult<()> {
6767
//! if x < 0 {
6868
//! return Err(String::from("must be non-negative").into());
6969
//! }
@@ -149,9 +149,9 @@ impl From<IoError> for AppError {
149149
/// Prefer structured validation for complex DTOs, but this covers simple cases.
150150
///
151151
/// ```rust
152-
/// use masterror::{AppError, AppErrorKind};
152+
/// use masterror::{AppError, AppErrorKind, AppResult};
153153
///
154-
/// fn check(name: &str) -> Result<(), AppError> {
154+
/// fn check(name: &str) -> AppResult<()> {
155155
/// if name.is_empty() {
156156
/// return Err(String::from("name must not be empty").into());
157157
/// }

src/convert/actix.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
//!
66
//! ## What it does
77
//! - Implements `actix_web::ResponseError` for [`AppError`].
8-
//! - This lets you `return Result<_, AppError>` from Actix handlers.
8+
//! - This lets you `return AppResult<_>` from Actix handlers.
99
//! - On error, Actix automatically builds an `HttpResponse` with the right
1010
//! status code and JSON body (when the `serde_json` feature is enabled).
1111
//! - Provides stable mapping from [`AppErrorKind`] to

src/convert/validator.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
//! ## Example
2020
//!
2121
//! ```rust,ignore
22-
//! use masterror::{AppError, AppErrorKind};
22+
//! use masterror::{AppError, AppErrorKind, AppResult};
2323
//! use validator::{Validate, ValidationError};
2424
//!
2525
//! #[derive(Validate)]
@@ -28,7 +28,7 @@
2828
//! name: String,
2929
//! }
3030
//!
31-
//! fn validate_payload(p: Payload) -> Result<(), AppError> {
31+
//! fn validate_payload(p: Payload) -> AppResult<()> {
3232
//! p.validate()?;
3333
//! Ok(())
3434
//! }

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
//! - [`AppError`] — thin wrapper around a semantic error kind and optional
1111
//! message
1212
//! - [`AppErrorKind`] — stable internal taxonomy of application errors
13-
//! - [`AppResult`] — convenience alias `Result<T, AppError>`
13+
//! - [`AppResult`] — convenience alias for returning [`AppError`]
1414
//! - [`ErrorResponse`] — stable wire-level JSON payload for HTTP APIs
1515
//! - [`AppCode`] — public, machine-readable error code for clients
1616
//!

src/prelude.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ pub use crate::AppCode;
3535
pub use crate::AppError;
3636
/// High-level taxonomy of application errors (stable categories).
3737
pub use crate::AppErrorKind;
38-
/// Convenience alias `Result<T, AppError>` used in handlers/services.
38+
/// Convenience alias for returning [`AppError`] from handlers/services.
3939
pub use crate::AppResult;
4040
/// Stable wire-level error payload for HTTP APIs.
4141
pub use crate::ErrorResponse;

0 commit comments

Comments
 (0)