tastyerrors 2025.0.2
An awesome library for  40+ additional useful Python exceptions
License: Apache License 2.0

﻿
# 🌶️ tastyerrors: The Exception Library That Just Gets It

[![PyPI Version](https://img.shields.io/pypi/v/tastyerrors?label=Latest%20Release)](https://pypi.org/project/tastyerrors/)
[![License](https://img.shields.io/badge/License-Apache%202.0-blue.svg)](https://www.apache.org/licenses/LICENSE-2.0)
![Maintenance](https://img.shields.io/badge/Status-Engineered-brightgreen.svg)

## 🤯 Why Use `tastyerrors`?

Look, we've all been there. You're writing code, things break, and Python throws a generic `Exception`. You stare at the traceback and think, "What am I, a detective?"

**`tastyerrors`** is here to stop the madness. We don't just raise exceptions; we give them names, docstrings, and a dedicated place in the hierarchy so you know *exactly* why your user's password was too short, or why their database connection is on the fritz. We believe every error message should be a small, dramatic novella.

Plus, we’ve made sure our foundation is solid. All of our code, including the whopping 43+ exceptions, is released under the **Apache License, Version 2.0**. This means you can use, modify, and distribute this library freely, even in commercial applications, as long as you provide proper attribution and adhere to the license terms. Go forth and fail elegantly!

---

## 🍴 Installation

```bash
pip install tastyerrors
```
---

## 👩‍🍳 Quick Usage: The Two Tastiest Ways To Fail

Thanks to our beautiful, new architecture, you can handle errors with surgical precision or raise them dynamically using their string names.
* 1: Catch 'em all!
### Example

```python
from tastyerrors import * # Wildcard is approved for quick use!

def check_user_input(username, password):
    if len(password) < 8:
        # A specific error with a clear name
        raise PasswordTooShort("Password requires at least 8 characters, please.")
    if username in ["admin", "root", "dev"]:
        # Another specific error
        raise InappropriateUsername("Reserved names are not allowed.")
    # ... and 41 other fun ways to fail

try:
    check_user_input("my_user", "short")
except TastyErrors as e:
    # Catch ALL 43 custom exceptions from the package in one go!
    print(f"❌ Application Error Caught: {type(e).__name__}")
    print(f"   Reason: {e}")
except Exception as e:
    # Catch general Python errors (like BadType)
    print(f"Python Standard Error: {type(e).__name__}")
```
* 2: Dynamic Raising ( new and tasty! )
Use the TastyRaiser class to dynamically look up and raise exceptions using their string names. Perfect for configuration files or API gateways where the error name is dynamic!
Just use the following steps, and you're good to go!
#### Step 1: Import it
```
from tastyerrors import TastyRaiser
```
#### Step 2: Get the Raiser rolling!
```
# Initialize the raiser
raiser = TastyRaiser()
```
#### Step 3: Set your error message ❎
```
raiser.set_error_msg('Eat, sleep, code')
```
#### Step 4: Raise your error, dude!
```
# Syntax : raiser.RaiseTasty([error string])
raiser.RaiseTasty('AuthError')
```


---

## 📋 Exception Documentation (The Full Menu)

We currently feature **43** exceptions across 7 delicious categories. Yes, that's right—we blew past the answer to the universe (**42**) and gave you one more for good measure.

### Featured Category: Color Picking (New in v2025.0.1)

| Exception Class | Inherits From | When to Use |
| :--- | :--- | :--- |
| `ColorError` | `InputError` | Base class for all color-related validation issues. |
| **`InvalidColorFormatError`** | `ColorError` | The user gave you `"banana"` when you needed a hex code (`#FFD700`). |
| **`ColorNotInPaletteError`** | `ColorError` | The color is valid, but your design constraints (e.g., brand guidelines) don't allow it. |

### Full List by Category (Excluding Base Classes)

| Category | Base Class | Examples |
| :--- | :--- | :--- |
| **Authentication** | `AuthError` | `UsernameNotFound`, `IncorrectPassword`, `RetryLimitExceededError` |
| **Validation** | `BadPassword` / `BadUsername` | `PasswordTooShort`, `NotUniqueUsername`, `InappropriatePassword` |
| **Processing** | `ProcessingError` | `RateLimitExceededError`, `APIException`, `NetworkError` |
| **Data Integrity** | `ProcessingError` | `DataIntegrityError`, `DataNotFoundError` |
| **Financial/Inventory** | `TastyErrors` | `InsufficientFundsError`, `InventoryError` |
| **System & Resources** | `SystemError` | `MemoryExhaustedError`, `ConcurrencyException`, `DependencyError` |
| **Network/Built-in Wrappers** | (Various Built-ins) | `ServiceNotAvailable`, `TimeOutException`, `BadType` |

---
# 🚀Changelog

## 🧑‍🚀v2025.0.2

This IS the ultimate release of _TastyErrors_. We've brought you groundbreaking features.
* We've created the all-new TastyRaiser utility. It is built to use dynamic lookup, guaranteeing stability and predictability when raising exceptions by string name.
* Documentation Refinement: We've updated _README.md_ to clearly demonstrate the two main usage patterns: explicit import/catch and dynamic raising.

## 🧑‍🚀 Release Notes: v2025.0.1

This is the big one. We didn't just add features; we rebuilt the kitchen foundation.

### **BREAKING CHANGES (And Why They Are Good)**

* **Goodbye `BaseException`:** All custom classes now inherit from the standard Python **`Exception`** class (via `TastyErrors`), meaning your users' code won't accidentally catch critical system errors like `SystemExit` or `KeyboardInterrupt`. **You must now catch `TastyErrors` instead of previous base classes.**

### **Features & Expansion (The 43 Club)**

* **New Base Class:** Introduced **`TastyErrors`** as the single root catch-all for the entire library.
* **New Exceptions:** Added **5 new, highly requested classes**, bringing the total count to **43**:
    * `RateLimitExceededError`
    * `DataIntegrityError`
    * `ColorError`
    * `InvalidColorFormatError`
    * `ColorNotInPaletteError`
* **Professional Docstrings:** Every single class now has a clear, professional docstring explaining its intended use case.