7
7
8
8
9
9
async def code_check (code : str , uid : str = None , trace_id : str = None ):
10
- if code in ["parse_task_limit_exceeded " , "parse_concurrency_limit" ]:
10
+ if code in ["parse_page_limit_exceeded " , "parse_concurrency_limit" ]:
11
11
raise RateLimit ()
12
12
if code in RequestError .ERROR_CODES :
13
13
raise RequestError (code , uid = uid , trace_id = trace_id )
@@ -20,7 +20,8 @@ class RateLimit(Exception):
20
20
Error when rate limit is reached.
21
21
"""
22
22
23
- pass
23
+ def __str__ (self ):
24
+ return "Rate limit reached. Please wait a moment and try again. (速率限制,请稍后重试)"
24
25
25
26
26
27
class RequestError (Exception ):
@@ -29,7 +30,7 @@ class RequestError(Exception):
29
30
"""
30
31
31
32
ERROR_CODES = {
32
- "parse_page_limit_exceeded " : "可用的解析页数额度不足 (Insufficient page quota)" ,
33
+ "parse_quota_limit " : "可用的解析页数额度不足 (Insufficient parsing quota)" ,
33
34
"parse_create_task_error" : "创建任务失败 (Failed to create task)" ,
34
35
"parse_file_too_large" : "单个文件大小超过限制 (File size exceeds limit)" ,
35
36
"parse_file_page_limit" : "单个文件页数超过限制 (File page count exceeds limit)" ,
@@ -42,7 +43,7 @@ class RequestError(Exception):
42
43
}
43
44
44
45
SOLUTIONS = {
45
- "parse_page_limit_exceeded " : "当前可用的页数不够 (Not enough available pages )" ,
46
+ "parse_quota_limit " : "当前可用的页数不足,请检查余额或联系负责人 (Insufficient parsing quota, check balance or contact support )" ,
46
47
"parse_create_task_error" : "短暂等待后重试, 如果还出现报错则请联系负责人 (Retry after a short wait, contact support if error persists)" ,
47
48
"parse_file_too_large" : "当前允许单个文件大小 <= 300M, 请拆分 pdf (File size must be <= 300MB, please split the PDF)" ,
48
49
"parse_file_page_limit" : "当前允许单个文件页数 <= 1000页, 请拆分 pdf (File page count must be <= 1000 pages, please split the PDF)" ,
0 commit comments