Skip to main content

Crate error_code

Crate error_code 

Source
Expand description

Error code library provides generic errno/winapi error wrapper

User can define own Category if you want to create new error wrapper.

§Features

  • std - Enables std::error::Error implementation and conversion from std::io::Error

§Usage

use error_code::ErrorCode;

use std::fs::File;

File::open("non_existing");
println!("{}", ErrorCode::last_system());

Modules§

defs
Definitions used by this library
types
C types used inside crate
utils
Error code utilities

Macros§

define_category
Defines error code Category as enum which implements conversion into generic ErrorCode

Structs§

Category
Interface for error category
ErrorCode
Describes error code of particular category.

Constants§

FAIL_ERROR_FORMAT
Text to return when error fails to be converted into utf-8
MESSAGE_BUF_SIZE
Error message buffer size
UNKNOWN_ERRORDeprecated
Text to return when cannot map error

Statics§

POSIX_CATEGORY
Posix error category, suitable for all environments.
SYSTEM_CATEGORY
System error category, suitable for all environments.

Type Aliases§

MessageBuf
Type alias for buffer to hold error code description.
Result
Type alias for Result with ErrorCode as error variant by default