1use crate::i18n::I18N;
2use std::sync::Arc;
3
4#[derive(Debug, thiserror::Error)]
5#[error(transparent)]
6pub struct IoError(pub Arc<std::io::Error>);
7
8impl PartialEq for IoError {
9 fn eq(&self, other: &Self) -> bool {
10 Arc::ptr_eq(&self.0, &other.0)
11 }
12}
13impl Eq for IoError {}
14
15impl From<std::io::Error> for IoError {
16 fn from(e: std::io::Error) -> Self {
17 IoError(Arc::new(e))
18 }
19}
20
21#[derive(Debug, thiserror::Error)]
22#[error(transparent)]
23pub struct JsonError(pub Arc<serde_json::Error>);
24
25impl PartialEq for JsonError {
26 fn eq(&self, other: &Self) -> bool {
27 Arc::ptr_eq(&self.0, &other.0)
28 }
29}
30impl Eq for JsonError {}
31
32impl From<serde_json::Error> for JsonError {
33 fn from(e: serde_json::Error) -> Self {
34 JsonError(Arc::new(e))
35 }
36}
37
38#[cfg(feature = "zip")]
39#[derive(Debug, thiserror::Error)]
40#[error(transparent)]
41pub struct ZipErr(pub Arc<zip::result::ZipError>);
42
43#[cfg(feature = "zip")]
44impl PartialEq for ZipErr {
45 fn eq(&self, other: &Self) -> bool {
46 Arc::ptr_eq(&self.0, &other.0)
47 }
48}
49#[cfg(feature = "zip")]
50impl Eq for ZipErr {}
51
52#[cfg(feature = "zip")]
53impl From<zip::result::ZipError> for ZipErr {
54 fn from(e: zip::result::ZipError) -> Self {
55 ZipErr(Arc::new(e))
56 }
57}
58
59#[cfg(target_os = "android")]
60#[derive(Debug, thiserror::Error)]
61#[error(transparent)]
62pub struct JniError(pub Arc<jni::errors::Error>);
63
64#[cfg(target_os = "android")]
65impl PartialEq for JniError {
66 fn eq(&self, other: &Self) -> bool {
67 Arc::ptr_eq(&self.0, &other.0)
68 }
69}
70#[cfg(target_os = "android")]
71impl Eq for JniError {}
72
73#[cfg(target_os = "android")]
74impl From<jni::errors::Error> for JniError {
75 fn from(e: jni::errors::Error) -> Self {
76 JniError(Arc::new(e))
77 }
78}
79
80#[derive(Debug, PartialEq, Eq, thiserror::Error)]
81pub enum Error {
82 #[error("I/O error: {0}")]
83 IO(IoError),
84 #[cfg(target_os = "android")]
85 #[error("JNI error: {0}")]
86 JNI(JniError),
87 #[error("JSON error: {0}")]
88 Json(JsonError),
89 #[error("Base64 decoding error: {0}")]
90 Base64(base64::DecodeError),
91 #[cfg(feature = "qr")]
92 #[error("QR code error: {0}")]
93 Qr(#[from] rxing::Exceptions),
94 #[error("Environment error: {0}")]
95 Env(#[from] std::env::VarError),
96 #[error("Channel error: {0}")]
97 Channel(#[from] std::sync::mpsc::RecvError),
98 #[error("JS error: {0}")]
99 JS(String),
100 #[error("No QR found in image")]
101 QrNotFound,
102 #[error("Eval channel closed before completion")]
103 EvalFinished,
104 #[cfg(feature = "crypto")]
105 #[error("Cipher initialization error: {0}")]
106 Cipher(cipher::InvalidLength),
107 #[cfg(feature = "crypto")]
108 #[error("Key derivation error: {0}")]
109 KeyDerive(#[from] argon2::Error),
110 #[cfg(feature = "crypto")]
111 #[error("Random number generation error: {0}")]
112 Getrandom(#[from] getrandom::Error),
113 #[cfg(feature = "crypto")]
114 #[error("Encryption failed: {0}")]
115 Encrypt(aead::Error),
116 #[cfg(feature = "crypto")]
117 #[error("Decryption failed: {0}")]
118 Decrypt(aead::Error),
119 #[error("Invalid encrypted payload format: {0}")]
120 InvalidFormat(String),
121 #[error("Numeric conversion failed ({context}): {source}")]
122 Convert {
123 context: &'static str,
124 source: std::num::TryFromIntError,
125 },
126 #[error("Camera not available: {0}")]
127 CameraNotAvailable(String),
128 #[error("Camera permission denied: {0}")]
129 CameraPermissionDenied(String),
130 #[error("Camera feed stalled: no frames received")]
131 CameraStalled,
132 #[error("Not a JSON object: {0}")]
133 NotJsonObject(serde_json::Value),
134 #[cfg(feature = "zip")]
135 #[error("Archive error: {0}")]
136 Archive(ZipErr),
137 #[error("Background task error: {0}")]
138 Worker(WorkerStopped),
139 #[error("File too large ({name}: {size} bytes, limit {limit} bytes)")]
140 FileTooLarge { name: String, size: u64, limit: u64 },
141 #[error("Archive has too many entries ({count}, limit {limit})")]
142 TooManyEntries { count: usize, limit: usize },
143 #[error("A password is required to open this encrypted archive")]
144 PasswordRequired,
145 #[error("Operation cancelled")]
146 Cancelled,
147 #[error("Required object unavailable: {0}")]
148 Missing(Missing),
149 #[error("{0} is unavailable: web feature disabled")]
150 CapabilityDisabled(Capability),
151 #[error("Clipboard error: {0}")]
152 Clipboard(ClipboardError),
153 #[cfg(target_arch = "wasm32")]
154 #[error("JavaScript operation failed: {0}")]
155 Js(JsError),
156 #[error("File picker timed out")]
157 FilePickerTimedOut,
158 #[error("File picker failed")]
159 FilePickerFailed,
160 #[error("Save was cancelled")]
161 SaveCancelled,
162 #[error("xdg-open failed for {url}")]
163 OpenUrlFailed { url: String },
164 #[error("xdg-open timed out for {url}")]
165 OpenUrlTimedOut { url: String },
166 #[error("Share failed: {0}")]
167 ShareFailed(Box<Error>),
168}
169
170#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
173pub enum Missing {
174 #[error("window")]
175 Window,
176 #[error("document")]
177 Document,
178 #[error("document body")]
179 Body,
180 #[error("video element")]
181 VideoElement,
182 #[error("canvas")]
183 Canvas,
184 #[error("2D context")]
185 Context2d,
186 #[error("localStorage")]
187 LocalStorage,
188 #[error("anchor element")]
189 Anchor,
190 #[error("input element")]
191 Input,
192 #[error("file entry")]
193 FileEntry,
194 #[error("clipboard text")]
195 ClipboardText,
196 #[error("desktop session")]
197 DesktopSession,
198 #[error("Android application")]
199 AndroidApp,
200 #[error("data directory")]
201 DataDir,
202}
203
204impl I18N for Missing {
205 fn render_eng(&self) -> String {
206 match self {
207 Self::Window => "window".into(),
208 Self::Document => "document".into(),
209 Self::Body => "document body".into(),
210 Self::VideoElement => "video element".into(),
211 Self::Canvas => "canvas".into(),
212 Self::Context2d => "2D context".into(),
213 Self::LocalStorage => "localStorage".into(),
214 Self::Anchor => "anchor element".into(),
215 Self::Input => "input element".into(),
216 Self::FileEntry => "file entry".into(),
217 Self::ClipboardText => "clipboard text".into(),
218 Self::DesktopSession => "desktop session".into(),
219 Self::AndroidApp => "Android application".into(),
220 Self::DataDir => "data directory".into(),
221 }
222 }
223
224 fn render_spa(&self) -> String {
225 match self {
226 Self::Window => "ventana".into(),
227 Self::Document => "documento".into(),
228 Self::Body => "cuerpo del documento".into(),
229 Self::VideoElement => "elemento de video".into(),
230 Self::Canvas => "lienzo".into(),
231 Self::Context2d => "contexto 2D".into(),
232 Self::LocalStorage => "localStorage".into(),
233 Self::Anchor => "elemento de enlace".into(),
234 Self::Input => "campo de entrada".into(),
235 Self::FileEntry => "entrada de archivo".into(),
236 Self::ClipboardText => "texto del portapapeles".into(),
237 Self::DesktopSession => "sesión de escritorio".into(),
238 Self::AndroidApp => "aplicación de Android".into(),
239 Self::DataDir => "directorio de datos".into(),
240 }
241 }
242
243 fn render_rus(&self) -> String {
244 match self {
245 Self::Window => "окно".into(),
246 Self::Document => "документ".into(),
247 Self::Body => "тело документа".into(),
248 Self::VideoElement => "элемент видео".into(),
249 Self::Canvas => "холст".into(),
250 Self::Context2d => "контекст 2D".into(),
251 Self::LocalStorage => "localStorage".into(),
252 Self::Anchor => "элемент ссылки".into(),
253 Self::Input => "элемент ввода".into(),
254 Self::FileEntry => "запись файла".into(),
255 Self::ClipboardText => "текст в буфере обмена".into(),
256 Self::DesktopSession => "сеанс рабочего стола".into(),
257 Self::AndroidApp => "приложение Android".into(),
258 Self::DataDir => "каталог данных".into(),
259 }
260 }
261}
262
263#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
265pub enum Capability {
266 #[error("clipboard")]
267 Clipboard,
268 #[error("share")]
269 Share,
270 #[error("save")]
271 Save,
272}
273
274impl I18N for Capability {
275 fn render_eng(&self) -> String {
276 match self {
277 Self::Clipboard => "Clipboard".into(),
278 Self::Share => "Sharing".into(),
279 Self::Save => "Saving".into(),
280 }
281 }
282
283 fn render_spa(&self) -> String {
284 match self {
285 Self::Clipboard => "Portapapeles".into(),
286 Self::Share => "Compartir".into(),
287 Self::Save => "Guardar".into(),
288 }
289 }
290
291 fn render_rus(&self) -> String {
292 match self {
293 Self::Clipboard => "Буфер обмена".into(),
294 Self::Share => "Общий доступ".into(),
295 Self::Save => "Сохранение".into(),
296 }
297 }
298}
299
300#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error)]
302pub enum ClipboardError {
303 #[error("unavailable")]
304 Unavailable,
305 #[error("busy")]
306 Busy,
307 #[error("content unavailable")]
308 ContentUnavailable,
309 #[error("conversion failed")]
310 ConversionFailed,
311 #[error("{0}")]
312 Unknown(String),
313}
314
315impl I18N for ClipboardError {
316 fn render_eng(&self) -> String {
317 match self {
318 Self::Unavailable => "unavailable".into(),
319 Self::Busy => "busy".into(),
320 Self::ContentUnavailable => "content unavailable".into(),
321 Self::ConversionFailed => "conversion failed".into(),
322 Self::Unknown(detail) => detail.clone(),
323 }
324 }
325
326 fn render_spa(&self) -> String {
327 match self {
328 Self::Unavailable => "no disponible".into(),
329 Self::Busy => "ocupado".into(),
330 Self::ContentUnavailable => "contenido no disponible".into(),
331 Self::ConversionFailed => "error de conversión".into(),
332 Self::Unknown(detail) => detail.clone(),
333 }
334 }
335
336 fn render_rus(&self) -> String {
337 match self {
338 Self::Unavailable => "недоступен".into(),
339 Self::Busy => "занят".into(),
340 Self::ContentUnavailable => "содержимое недоступно".into(),
341 Self::ConversionFailed => "ошибка преобразования".into(),
342 Self::Unknown(detail) => detail.clone(),
343 }
344 }
345}
346
347#[cfg(target_arch = "wasm32")]
350#[derive(Debug, Clone, thiserror::Error)]
351#[error("{0:?}")]
352pub struct JsError(pub Arc<web_sys::wasm_bindgen::JsValue>);
353
354#[cfg(target_arch = "wasm32")]
355impl PartialEq for JsError {
356 fn eq(&self, other: &Self) -> bool {
357 Arc::ptr_eq(&self.0, &other.0)
358 }
359}
360
361#[cfg(target_arch = "wasm32")]
362impl Eq for JsError {}
363
364#[cfg(target_arch = "wasm32")]
365impl From<web_sys::wasm_bindgen::JsValue> for JsError {
366 fn from(e: web_sys::wasm_bindgen::JsValue) -> Self {
367 Self(Arc::new(e))
368 }
369}
370
371#[cfg(target_arch = "wasm32")]
372impl From<web_sys::wasm_bindgen::JsValue> for Error {
373 fn from(e: web_sys::wasm_bindgen::JsValue) -> Self {
374 Self::Js(JsError::from(e))
375 }
376}
377
378#[derive(Debug, Clone, Copy, PartialEq, Eq, thiserror::Error)]
379#[error("Background task stopped unexpectedly")]
380pub struct WorkerStopped;
381
382impl From<std::io::Error> for Error {
383 fn from(e: std::io::Error) -> Self {
384 Error::IO(IoError::from(e))
385 }
386}
387
388impl From<serde_json::Error> for Error {
389 fn from(e: serde_json::Error) -> Self {
390 Error::Json(JsonError::from(e))
391 }
392}
393
394impl From<base64::DecodeError> for Error {
395 fn from(e: base64::DecodeError) -> Self {
396 Error::Base64(e)
397 }
398}
399
400#[cfg(feature = "crypto")]
401impl From<cipher::InvalidLength> for Error {
402 fn from(e: cipher::InvalidLength) -> Self {
403 Error::Cipher(e)
404 }
405}
406
407#[cfg(target_os = "android")]
408impl From<jni::errors::Error> for Error {
409 fn from(e: jni::errors::Error) -> Self {
410 Error::JNI(JniError::from(e))
411 }
412}
413
414impl From<WorkerStopped> for Error {
415 fn from(e: WorkerStopped) -> Self {
416 Error::Worker(e)
417 }
418}
419
420#[cfg(feature = "zip")]
421impl From<zip::result::ZipError> for Error {
422 fn from(e: zip::result::ZipError) -> Self {
423 Error::Archive(ZipErr::from(e))
424 }
425}
426
427impl I18N for Error {
428 fn render_eng(&self) -> String {
429 match self {
430 Self::IO(e) => format!("I/O error: {e}"),
431 Self::Json(e) => format!("JSON parsing error: {e}"),
432 Self::Base64(e) => format!("Base64 decoding error: {e}"),
433 #[cfg(feature = "qr")]
434 Self::Qr(e) => format!("QR code error: {e}"),
435 Self::Env(e) => format!("Environment variable error: {e}"),
436 Self::Channel(e) => format!("Channel receive error: {e}"),
437 Self::JS(e) => format!("JavaScript evaluation error: {e}"),
438 Self::QrNotFound => "No QR found in image".into(),
439 Self::EvalFinished => "The connection to the browser was lost; please try again".into(),
440 #[cfg(feature = "crypto")]
441 Self::Cipher(e) => format!("Cipher initialization error: {e}"),
442 #[cfg(feature = "crypto")]
443 Self::KeyDerive(e) => format!("Key derivation error: {e}"),
444 #[cfg(feature = "crypto")]
445 Self::Getrandom(e) => format!("Random number generation error: {e}"),
446 #[cfg(feature = "crypto")]
447 Self::Encrypt(e) => format!("Encryption failed: {e}"),
448 #[cfg(feature = "crypto")]
449 Self::Decrypt(e) => format!("Decryption failed: {e}"),
450 Self::InvalidFormat(e) => format!("Invalid encrypted payload format: {e}"),
451 Self::Convert { context, source } => {
452 format!("Numeric conversion failed ({context}): {source}")
453 }
454 Self::CameraNotAvailable(e) => format!("Camera is not available: {e}"),
455 Self::CameraPermissionDenied(e) => format!("Camera permission was denied: {e}"),
456 Self::CameraStalled => "The camera feed stopped responding; try again".into(),
457 Self::NotJsonObject(e) => format!("Expected JSON object, got: {e}"),
458 #[cfg(feature = "zip")]
459 Self::Archive(e) => format!("Archive error: {e}"),
460 Self::Worker(_) => "Background task stopped unexpectedly".into(),
461 Self::FileTooLarge { name, size, limit } => {
462 format!("File too large ({name}: {size} bytes, limit {limit} bytes)")
463 }
464 Self::TooManyEntries { count, limit } => {
465 format!("Archive has too many entries ({count}, limit {limit})")
466 }
467 Self::PasswordRequired => {
468 "A password is required to open this encrypted archive".into()
469 }
470 Self::Cancelled => "Operation cancelled".into(),
471 Self::Missing(m) => {
472 format!("Required object unavailable: {}", m.render_eng())
473 }
474 Self::CapabilityDisabled(c) => {
475 format!("{} is unavailable: web feature disabled", c.render_eng())
476 }
477 Self::Clipboard(e) => format!("Clipboard error: {}", e.render_eng()),
478 #[cfg(target_arch = "wasm32")]
479 Self::Js(e) => format!("JavaScript operation failed: {e}"),
480 Self::FilePickerTimedOut => "File picker timed out".into(),
481 Self::FilePickerFailed => "File picker failed".into(),
482 Self::SaveCancelled => "Save was cancelled".into(),
483 Self::OpenUrlFailed { url } => format!("xdg-open failed for {url}"),
484 Self::OpenUrlTimedOut { url } => format!("xdg-open timed out for {url}"),
485 #[cfg(target_os = "android")]
486 Self::JNI(e) => format!("JNI error: {e}"),
487 Self::ShareFailed(e) => format!("Share failed: {e}"),
488 }
489 }
490
491 fn render_spa(&self) -> String {
492 match self {
493 Self::IO(e) => format!("Error de E/S: {e}"),
494 Self::Json(e) => format!("Error de análisis JSON: {e}"),
495 Self::Base64(e) => format!("Error de decodificación Base64: {e}"),
496 #[cfg(feature = "qr")]
497 Self::Qr(e) => format!("Error de código QR: {e}"),
498 Self::Env(e) => format!("Error de variable de entorno: {e}"),
499 Self::Channel(e) => format!("Error de recepción en canal: {e}"),
500 Self::JS(e) => format!("Error de evaluación JavaScript: {e}"),
501 Self::QrNotFound => "No se encontró ningún QR en la imagen".into(),
502 Self::EvalFinished => {
503 "Se perdió la conexión con el navegador; inténtalo de nuevo".into()
504 }
505 #[cfg(feature = "crypto")]
506 Self::Cipher(e) => format!("Error al inicializar el cifrado: {e}"),
507 #[cfg(feature = "crypto")]
508 Self::KeyDerive(e) => format!("Error al derivar la clave: {e}"),
509 #[cfg(feature = "crypto")]
510 Self::Getrandom(e) => format!("Error al generar números aleatorios: {e}"),
511 #[cfg(feature = "crypto")]
512 Self::Encrypt(e) => format!("No se pudo cifrar: {e}"),
513 #[cfg(feature = "crypto")]
514 Self::Decrypt(e) => format!("No se pudo descifrar: {e}"),
515 Self::InvalidFormat(e) => format!("Formato de datos cifrados no válido: {e}"),
516 Self::Convert { context, source } => {
517 format!("Error de conversión numérica ({context}): {source}")
518 }
519 Self::CameraNotAvailable(e) => format!("La cámara no está disponible: {e}"),
520 Self::CameraPermissionDenied(e) => format!("Se denegó el permiso de cámara: {e}"),
521 Self::CameraStalled => "La cámara dejó de responder; inténtalo de nuevo".into(),
522 Self::NotJsonObject(e) => format!("Se esperaba un objeto JSON, se obtuvo: {e}"),
523 #[cfg(feature = "zip")]
524 Self::Archive(e) => format!("Error de archivo: {e}"),
525 Self::Worker(_) => "La tarea en segundo plano se detuvo inesperadamente".into(),
526 Self::FileTooLarge { name, size, limit } => {
527 format!("Archivo demasiado grande ({name}: {size} bytes, límite {limit} bytes)")
528 }
529 Self::TooManyEntries { count, limit } => {
530 format!("El archivo tiene demasiadas entradas ({count}, límite {limit})")
531 }
532 Self::PasswordRequired => {
533 "Se requiere una contraseña para abrir este archivo cifrado".into()
534 }
535 Self::Cancelled => "Operación cancelada".into(),
536 Self::Missing(m) => {
537 format!("Objeto requerido no disponible: {}", m.render_spa())
538 }
539 Self::CapabilityDisabled(c) => {
540 format!(
541 "{} no está disponible: función web deshabilitada",
542 c.render_spa()
543 )
544 }
545 Self::Clipboard(e) => format!("Error del portapapeles: {}", e.render_spa()),
546 #[cfg(target_arch = "wasm32")]
547 Self::Js(e) => format!("La operación JavaScript falló: {e}"),
548 Self::FilePickerTimedOut => {
549 "Se agotó el tiempo de espera del selector de archivos".into()
550 }
551 Self::FilePickerFailed => "El selector de archivos falló".into(),
552 Self::SaveCancelled => "Se canceló el guardado".into(),
553 Self::OpenUrlFailed { url } => format!("xdg-open no pudo abrir {url}"),
554 Self::OpenUrlTimedOut { url } => {
555 format!("xdg-open agotó el tiempo de espera para {url}")
556 }
557 #[cfg(target_os = "android")]
558 Self::JNI(e) => format!("Error JNI: {e}"),
559 Self::ShareFailed(e) => format!("No se pudo compartir: {e}"),
560 }
561 }
562
563 fn render_rus(&self) -> String {
564 match self {
565 Self::IO(e) => format!("Ошибка ввода-вывода: {e}"),
566 Self::Json(e) => format!("Ошибка разбора JSON: {e}"),
567 Self::Base64(e) => format!("Ошибка декодирования Base64: {e}"),
568 #[cfg(feature = "qr")]
569 Self::Qr(e) => format!("Ошибка QR-кода: {e}"),
570 Self::Env(e) => format!("Ошибка переменной окружения: {e}"),
571 Self::Channel(e) => format!("Ошибка получения из канала: {e}"),
572 Self::JS(e) => format!("Ошибка выполнения JavaScript: {e}"),
573 Self::QrNotFound => "QR-код не найден на изображении".into(),
574 Self::EvalFinished => "Соединение с браузером потеряно; попробуйте ещё раз".into(),
575 #[cfg(feature = "crypto")]
576 Self::Cipher(e) => format!("Ошибка инициализации шифра: {e}"),
577 #[cfg(feature = "crypto")]
578 Self::KeyDerive(e) => format!("Ошибка формирования ключа: {e}"),
579 #[cfg(feature = "crypto")]
580 Self::Getrandom(e) => format!("Ошибка генерации случайных чисел: {e}"),
581 #[cfg(feature = "crypto")]
582 Self::Encrypt(e) => format!("Ошибка шифрования: {e}"),
583 #[cfg(feature = "crypto")]
584 Self::Decrypt(e) => format!("Ошибка расшифровки: {e}"),
585 Self::InvalidFormat(e) => format!("Неверный формат зашифрованных данных: {e}"),
586 Self::Convert { context, source } => {
587 format!("Ошибка числового преобразования ({context}): {source}")
588 }
589 Self::CameraNotAvailable(e) => format!("Камера недоступна: {e}"),
590 Self::CameraPermissionDenied(e) => format!("Доступ к камере запрещён: {e}"),
591 Self::CameraStalled => "Поток с камеры остановился; попробуйте ещё раз".into(),
592 Self::NotJsonObject(e) => format!("Ожидался JSON-объект, получено: {e}"),
593 #[cfg(feature = "zip")]
594 Self::Archive(e) => format!("Ошибка архива: {e}"),
595 Self::Worker(_) => "Фоновая задача неожиданно остановилась".into(),
596 Self::FileTooLarge { name, size, limit } => {
597 format!("Файл слишком большой ({name}: {size} байт, лимит {limit} байт)")
598 }
599 Self::TooManyEntries { count, limit } => {
600 format!("В архиве слишком много записей ({count}, лимит {limit})")
601 }
602 Self::PasswordRequired => {
603 "Для открытия этого зашифрованного архива требуется пароль".into()
604 }
605 Self::Cancelled => "Операция отменена".into(),
606 Self::Missing(m) => {
607 format!("Требуемый объект недоступен: {}", m.render_rus())
608 }
609 Self::CapabilityDisabled(c) => {
610 format!(
611 "Возможность «{}» недоступна: веб-функция отключена",
612 c.render_rus()
613 )
614 }
615 Self::Clipboard(e) => format!("Ошибка буфера обмена: {}", e.render_rus()),
616 #[cfg(target_arch = "wasm32")]
617 Self::Js(e) => format!("Операция JavaScript не выполнена: {e}"),
618 Self::FilePickerTimedOut => "Выбор файла: время ожидания истекло".into(),
619 Self::FilePickerFailed => "Не удалось выбрать файл".into(),
620 Self::SaveCancelled => "Сохранение отменено".into(),
621 Self::OpenUrlFailed { url } => format!("xdg-open не смог открыть {url}"),
622 Self::OpenUrlTimedOut { url } => format!("xdg-open превысил время ожидания для {url}"),
623 #[cfg(target_os = "android")]
624 Self::JNI(e) => format!("Ошибка JNI: {e}"),
625 Self::ShareFailed(e) => format!("Не удалось поделиться: {e}"),
626 }
627 }
628}