🦆 waddling-sequences
Standard error sequence definitions for the Waddling ecosystem
What is this?
waddling-sequences provides standardized error sequence numbers with semantic meanings that are consistent across the entire Waddling ecosystem.
Think of it like HTTP status codes for errors:
- Everyone knows
404 = Not Found - With Waddling: Everyone knows
001 = Missing,002 = Mismatch, etc.
Features
- ✅ Zero dependencies - Just pure constants
- ✅ No-std compatible - Works everywhere
- ✅ Tree-shakeable - Only imports what you use
- ✅ Universal - Works with any error library
- ✅ Well-documented - Every sequence has clear meaning
Quick Start
use *;
// Use standard sequences with semantic meaning
const MY_ERROR_CODE: u16 = MISSING; // 001 - always means "missing"
const OTHER_ERROR: u16 = MISMATCH; // 002 - always means "mismatch"
// Everyone in the ecosystem knows what these mean!
Sequence Categories
Core Errors (001-010)
use *;
MISSING // 001 - Required item not found/provided
MISMATCH // 002 - Values don't match expected
INVALID // 003 - Format/validation failed
OVERFLOW // 004 - Value too large
UNDERFLOW // 005 - Value too small
OUTOFBOUNDS // 006 - Index outside valid range
TIMEOUT // 007 - Operation timed out
DENIED // 008 - Permission denied
UNSUPPORTED // 009 - Feature not supported
DEPRECATED // 010 - Feature deprecated
State/Lifecycle (011-020)
use *;
UNINITIALIZED // 011 - Not initialized
ALREADYINIT // 012 - Already initialized
CLOSED // 013 - Resource closed
NOTREADY // 014 - Not ready for operation
INPROGRESS // 015 - Operation in progress
CANCELLED // 016 - Operation cancelled
Resource Errors (021-030)
use *;
NOTFOUND // 021 - Resource not found
ALREADYEXISTS // 022 - Resource already exists
EXHAUSTED // 023 - Resource exhausted
LOCKED // 024 - Resource locked
CORRUPTED // 025 - Data corrupted
Success (998-999)
use *;
PARTIAL // 998 - Partial success
COMPLETE // 999 - Full completion
With Metadata Feature
Enable the metadata feature to get documentation strings:
[]
= { = "0.1", = ["metadata"] }
use DOCS;
// Get documentation for a sequence
let doc = DOCS.get.unwrap;
println!; // "Required item not found/provided"
Project-Specific Sequences
Sequences 031-897 are unreserved - use them for domain-specific errors!
// Your custom sequences
const MY_CUSTOM_ERROR: u16 = 031;
const ANOTHER_ERROR: u16 = 050;
Usage with waddling-errors
use ErrorCode;
use MISMATCH;
const TYPE_ERROR: ErrorCode =
new;
Why Standard Sequences?
Before (Inconsistent)
// Project A
const ERR_MISSING: u16 = 001; // "missing"
const ERR_NOTFOUND: u16 = 002; // "not found"
// Project B
const ERR_NOTFOUND: u16 = 001; // "not found"
const ERR_MISSING: u16 = 005; // "missing"
❌ Same concept, different numbers across projects!
After (Consistent)
// Project A
use MISSING; // 001
// Project B
use MISSING; // 001
✅ Same number, same meaning, everywhere!
Convention Document
See SEQUENCE-CONVENTIONS.md for full details on the standardized sequences.
No-std Support
Works in no-std environments:
use *;
License
Licensed under either of:
- Apache License, Version 2.0 (LICENSE-APACHE)
- MIT license (LICENSE-MIT)
at your option.
Contributing
Contributions are welcome! Please see CONTRIBUTING.md.
Made with 🦆 by the Waddling team