sqlite_graphrag/i18n/validation/
app_error_pt.rs1pub fn validation(msg: &str) -> String {
3 format!("erro de validação: {msg}")
4}
5
6pub fn duplicate(msg: &str) -> String {
8 let translated = msg
9 .replace("already exists in namespace", "já existe no namespace")
10 .replace(
11 "exists but is soft-deleted in namespace",
12 "existe mas está excluída temporariamente no namespace",
13 )
14 .replace(
15 "Use --force-merge to update.",
16 "Use --force-merge para atualizar.",
17 )
18 .replace(
19 "use --force-merge to restore and update, or `restore` to revive it",
20 "use --force-merge para restaurar e atualizar, ou `restore` para revivê-la",
21 )
22 .replace("memory", "memória");
23 format!("duplicata detectada: {translated}")
24}
25
26pub fn conflict(msg: &str) -> String {
28 let translated = msg
29 .replace("optimistic lock conflict", "conflito de lock otimista")
30 .replace("but current is", "mas atual é")
31 .replace(
32 "was modified by another process",
33 "foi modificada por outro processo",
34 );
35 format!("conflito: {translated}")
36}
37
38pub fn not_found(msg: &str) -> String {
40 let translated = msg
47 .replace("memory not found:", "memória não encontrada:")
48 .replace("not found in namespace", "não encontrada no namespace")
49 .replace("not found for memory", "não encontrada para memória")
50 .replace("does not exist in namespace", "não existe no namespace")
51 .replace("memory or entity", "memória ou entidade")
52 .replace("name='", "nome='")
53 .replace("memory", "memória")
54 .replace("entity", "entidade")
55 .replace(" in namespace '", " no namespace '")
56 .replace("version", "versão")
57 .replace("soft-deleted", "excluída temporariamente");
58 format!("não encontrado: {translated}")
59}
60
61pub fn memory_not_found(name: &str, namespace: &str) -> String {
66 not_found(&format!(
67 "memory not found: name='{name}' in namespace '{namespace}'"
68 ))
69}
70
71pub fn memory_not_found_by_id(id: i64) -> String {
73 not_found(&format!("memory not found: id={id}"))
74}
75
76pub fn entity_not_yet_materialized(name: &str, namespace: &str) -> String {
80 format!("entidade '{name}' ainda não materializada no namespace '{namespace}'")
81}
82
83pub fn namespace_error(msg: &str) -> String {
85 format!("namespace não resolvido: {msg}")
86}
87
88pub fn limit_exceeded(msg: &str) -> String {
90 let translated = msg
91 .replace("exceeds limit of", "excede limite de")
92 .replace("body exceeds", "corpo excede")
93 .replace("entities exceed limit", "entidades excedem limite")
94 .replace(
95 "relationships exceed limit",
96 "relacionamentos excedem limite",
97 );
98 format!("limite excedido: {translated}")
99}
100
101pub fn body_too_large(bytes: u64, limit: u64) -> String {
106 format!(
107 "limite excedido: corpo tem {bytes} bytes, acima do teto de {limit} bytes \
108 (MAX_MEMORY_BODY_LEN); divida o conteúdo em múltiplas memórias"
109 )
110}
111
112pub fn too_many_chunks(chunks: usize, limit: usize) -> String {
114 format!(
115 "limite excedido: documento produz {chunks} chunks, acima do teto de {limit} \
116 chunks (REMEMBER_MAX_SAFE_MULTI_CHUNKS); divida o documento antes da escrita"
117 )
118}
119
120pub fn too_many_tokens(tokens: u64, limit: u64) -> String {
124 format!(
125 "limite excedido: corpo tem {tokens} tokens (estimado), acima do teto de \
126 {limit} tokens (EMBEDDING_REQUEST_MAX_TOKENS); divida o conteúdo em \
127 múltiplas memórias"
128 )
129}
130
131pub fn database(err: &str) -> String {
133 format!("erro de banco de dados: {err}")
134}
135
136pub fn embedding(msg: &str) -> String {
138 format!("erro de embedding: {msg}")
139}
140
141pub fn vec_extension(msg: &str) -> String {
143 format!("extensão sqlite-vec falhou: {msg}")
144}
145
146pub fn provider_error(code: &str, message: &str) -> String {
148 format!("erro do provedor (código {code}): {message}")
149}
150
151pub fn db_busy(msg: &str) -> String {
153 format!("banco ocupado: {msg}")
154}
155
156pub fn batch_partial_failure(total: usize, failed: usize) -> String {
158 format!("falha parcial em batch: {failed} de {total} itens falharam")
159}
160
161pub fn io(err: &str) -> String {
163 format!("erro de I/O: {err}")
164}
165
166pub fn internal(err: &str) -> String {
168 format!("erro interno: {err}")
169}
170
171pub fn json(err: &str) -> String {
173 format!("erro de JSON: {err}")
174}
175
176pub fn lock_busy(msg: &str) -> String {
178 format!("lock ocupado: {msg}")
179}
180
181pub fn all_slots_full(max: usize, waited_secs: u64) -> String {
183 format!(
184 "todos os {max} slots de concorrência ocupados após aguardar {waited_secs}s \
185 (exit 75); use --max-concurrency ou aguarde outras invocações terminarem"
186 )
187}
188
189pub fn job_singleton_locked(job_type: &str, namespace: &str) -> String {
191 format!(
192 "job {job_type} para o namespace '{namespace}' já está em execução (exit 75); \
193 aguarde a conclusão ou passe --wait-job-singleton <SEGUNDOS>"
194 )
195}
196
197pub fn embedding_singleton_locked(namespace: &str) -> String {
199 format!(
200 "singleton de embedding para o namespace '{namespace}' já está retido (exit 75); \
201 outra CLI está chamando o LLM neste banco; passe --wait-embed-singleton <SEGUNDOS> para aguardar"
202 )
203}
204
205pub fn low_memory(available_mb: u64, required_mb: u64) -> String {
207 format!(
208 "memória disponível ({available_mb}MB) abaixo do mínimo requerido ({required_mb}MB) \
209 para carregar o modelo; aborte outras cargas ou use --skip-memory-guard (exit 77)"
210 )
211}
212
213pub fn shutdown(signal: &str) -> String {
215 format!("sinal de desligamento recebido: {signal}; operação cancelada pelo usuário (exit 19)")
216}
217
218pub fn preflight_failed(detail: &str) -> String {
220 format!(
221 "validação pré-execução falhou (exit 16): {detail}; corrija a condição e tente novamente (config set spawn.skip_preflight=1 desabilita em emergências)"
222 )
223}
224
225pub fn binary_not_found(name: &str) -> String {
227 format!("binário não encontrado: {name} — instale e adicione ao PATH")
228}
229
230pub fn rate_limited(detail: &str) -> String {
232 format!("taxa de requisição excedida: {detail}")
233}
234
235pub fn timeout(operation: &str, secs: u64) -> String {
237 format!("timeout após {secs}s: {operation}")
238}