Jump to content

Connect SuperML | Leeroopedia MCP: Equip your AI agents with best practices, code verification, and debugging knowledge. Powered by Leeroo — building Organizational Superintelligence. Contact us at founders@leeroo.com.

Implementation:Infiniflow Ragflow Custom Exceptions

From Leeroopedia
Knowledge Sources
Domains Error_Handling, Infrastructure
Last Updated 2026-02-12 06:00 GMT

Overview

Concrete exception classes for domain-specific error handling used across the RAGFlow application.

Description

The exceptions module defines three custom exception classes: TaskCanceledException for cancelled background tasks, ArgumentException for invalid function arguments, and NotFoundException for missing resources. These extend Python's built-in Exception class.

Usage

Raise these exceptions in service layer code when task processing is cancelled, function arguments are invalid, or requested resources cannot be found.

Code Reference

Source Location

Signature

class TaskCanceledException(Exception):
    """Raised when a background task is cancelled."""

class ArgumentException(Exception):
    """Raised when function arguments are invalid."""

class NotFoundException(Exception):
    """Raised when a requested resource is not found."""

Import

from common.exceptions import TaskCanceledException, ArgumentException, NotFoundException

I/O Contract

Inputs

Name Type Required Description
message str No Human-readable error description

Outputs

Name Type Description
Exception instance Exception Raised exception with message

Usage Examples

from common.exceptions import NotFoundException, TaskCanceledException

def get_document(doc_id):
    doc = db.find(doc_id)
    if not doc:
        raise NotFoundException(f"Document {doc_id} not found")
    return doc

Related Pages

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment