You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
MLCFlow uses a standardized system for error and warning codes to provide consistent error handling across the framework. This document explains the error code system and how to use it.
4
+
5
+
## Overview
6
+
7
+
The error code system consists of two main components:
8
+
9
+
1.**WarningCode(1000-1007)**: Enum class for warning codes (return = 0, with warning_code field)
10
+
2.**ErrorCode(2000-2007)**: Enum class for error codes (return > 0)
11
+
<!--
12
+
## Error Code Structure
13
+
14
+
Error codes are organized by category:
15
+
16
+
- **General errors (1000-1099)**: Common errors that can occur in any part of the system
17
+
- **Script errors (1100-1199)**: Errors specific to script execution and management
18
+
- **Repository errors (1200-1299)**: Errors related to repository operations
19
+
- **Cache errors (1300-1399)**: Errors related to cache operations
20
+
21
+
## Warning Code Structure
22
+
23
+
Warning codes follow a similar structure:
24
+
25
+
- **General warnings (2000-99)**: Common warnings that can occur in any part of the system
26
+
- **Script warnings (2100-2199)**: Warnings specific to script execution and management
27
+
- **Repository warnings (2200-2299)**: Warnings related to repository operations
28
+
- **Cache warnings (2300-2399)**: Warnings related to cache operations -->
29
+
30
+
## Usage
31
+
32
+
### In MLCFlow Framework
33
+
34
+
When returning an error:
35
+
36
+
```python
37
+
from mlc.error_codes import ErrorCode, get_error_message
return {'return': 1, 'error': f"""The target repo {target_repo} is not registered in MLC. Either register in MLC by cloning from Git through command `mlc pull repo` or create repo using `mlc add repo` command and try to rerun the command again"""}
0 commit comments