Skip to content

copyleftdev/pcepr

Repository files navigation

PCEPR - Platform Configuration Error Registry

What is PCEPR?

PCEPR (Platform Configuration Error Registry) is a Rust library for standardizing, registering, and managing platform configuration errors across systems. It provides a unified way to handle and reference error codes with their associated descriptions.

Why This Exists

The primary motivation behind PCEPR is to address several critical challenges in platform error management:

  1. Standardization: Many systems lack a consistent approach to error codes, leading to confusion, duplications, and inconsistencies across teams and components. PCEPR establishes a central registry that enforces uniqueness and proper documentation.

  2. Error Type Segmentation: PCEPR distinguishes between standard (well-established) errors and experimental errors, allowing teams to innovate without polluting the main error namespace.

  3. Centralized Documentation: Instead of having error definitions scattered across codebases, PCEPR provides a single source of truth for error codes, their meanings, and proper handling approaches.

  4. Configuration-Driven: Error definitions can be loaded from YAML configuration files, enabling version control of error codes and making it easier to maintain backward compatibility.

  5. Programmatic Access: The registry can be accessed programmatically, allowing systems to retrieve error information at runtime for better error reporting and handling.

Core Components

  • ErrorType/ErrorValue: The fundamental units representing error codes
  • StandardRegistry: Contains officially approved and stable error definitions
  • ExperimentalRegistry: Contains provisional errors that may eventually be promoted to standard
  • Configuration Loader: Loads error definitions from YAML files

Basic Usage

use pcepr::{StandardRegistry, ExperimentalRegistry, ErrorType, ErrorValue};

// Create registries
let mut std_reg = StandardRegistry::new();
let mut exp_reg = ExperimentalRegistry::new();

// Load error definitions from config file
pcepr::config::loader::load_registry_from_file("errors.yaml", &mut std_reg, &mut exp_reg)?;

// Now you can work with the registered errors

Configuration File Example

standard:
  - error_type: 1
    error_value: 1
    description: "Resource not found"
  - error_type: 1
    error_value: 2
    description: "Resource access denied"

experimental:
  - error_type: 200
    error_value: 1
    description: "Experimental feature unavailable"

License

[Add appropriate license here]

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages