Skip to content

Commit ed1fc9a

Browse files
committed
error messages wip
1 parent d2e0e35 commit ed1fc9a

File tree

2 files changed

+40
-48
lines changed

2 files changed

+40
-48
lines changed

rust/cryptonote/src/error.rs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,15 @@ impl AppError {
2222
t: &crate::i18n::Translations,
2323
) -> String {
2424
let msg = match self {
25-
AppError::Cipher(_) => t.crypto_error,
26-
AppError::Getrandom(_) => t.crypto_error,
27-
AppError::Base64(_) => t.encoding_error,
28-
AppError::Json(_) => t.encoding_error,
25+
AppError::Cipher(_) => t.cipher_error,
26+
AppError::Getrandom(_) => t.getrandom_error,
27+
AppError::Base64(_) => t.base64_error,
28+
AppError::Json(_) => t.json_error,
2929
AppError::Utf8(_) => t.utf8_error,
30-
AppError::Qr(_) => t.utf8_error,
31-
AppError::Encrypt => t.crypto_error,
32-
AppError::Decrypt => t.crypto_error,
33-
AppError::Url => t.invalid_url_error,
30+
AppError::Qr(_) => t.qr_error,
31+
AppError::Encrypt => t.encrypt_error,
32+
AppError::Decrypt => t.decrypt_error,
33+
AppError::Url => t.url_error,
3434
};
3535
format!("{}: {}", msg, self)
3636
}

rust/cryptonote/src/i18n.rs

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -44,19 +44,17 @@ pub struct Translations {
4444
pub error_title: &'static str,
4545
pub loading: &'static str,
4646
pub password_required: &'static str,
47-
pub encryption_failed: &'static str,
48-
pub qr_generation_failed: &'static str,
49-
pub url_generation_failed: &'static str,
50-
pub failed_to_parse_url: &'static str,
5147
pub no_note_in_url: &'static str,
52-
pub decryption_failed: &'static str,
5348
pub invalid_utf8: &'static str,
54-
pub crypto_error: &'static str,
55-
pub encoding_error: &'static str,
49+
pub cipher_error: &'static str,
50+
pub getrandom_error: &'static str,
51+
pub base64_error: &'static str,
52+
pub json_error: &'static str,
5653
pub utf8_error: &'static str,
57-
pub invalid_url_error: &'static str,
58-
pub missing_salt_error: &'static str,
59-
pub invalid_encryption_mode_error: &'static str,
54+
pub qr_error: &'static str,
55+
pub encrypt_error: &'static str,
56+
pub decrypt_error: &'static str,
57+
pub url_error: &'static str,
6058
}
6159

6260
pub fn get_translations(lang: Language) -> Translations {
@@ -79,19 +77,17 @@ pub fn get_translations(lang: Language) -> Translations {
7977
error_title: "Error",
8078
loading: "Loading note...",
8179
password_required: "Password is required for encryption",
82-
encryption_failed: "Encryption failed",
83-
qr_generation_failed: "QR generation failed",
84-
url_generation_failed: "URL generation failed",
85-
failed_to_parse_url: "Failed to parse URL",
8680
no_note_in_url: "No note found in URL",
87-
decryption_failed: "Decryption failed",
8881
invalid_utf8: "Decrypted data is not valid UTF-8",
89-
crypto_error: "Cryptography error",
90-
encoding_error: "Encoding error",
82+
cipher_error: "Cipher initialization error",
83+
getrandom_error: "Random number generation error",
84+
base64_error: "Base64 decoding error",
85+
json_error: "JSON parsing error",
9186
utf8_error: "Text encoding error",
92-
invalid_url_error: "Invalid URL format",
93-
missing_salt_error: "Missing encryption salt",
94-
invalid_encryption_mode_error: "Invalid encryption mode",
87+
qr_error: "QR code generation error",
88+
encrypt_error: "Encryption failed",
89+
decrypt_error: "Decryption failed",
90+
url_error: "Invalid URL format",
9591
},
9692
Language::Spanish => Translations {
9793
note_placeholder: "Escribe tu nota aquí...",
@@ -111,19 +107,17 @@ pub fn get_translations(lang: Language) -> Translations {
111107
error_title: "Error",
112108
loading: "Cargando nota...",
113109
password_required: "Se requiere contraseña para el cifrado",
114-
encryption_failed: "Falló el cifrado",
115-
qr_generation_failed: "Falló la generación del código QR",
116-
url_generation_failed: "Falló la generación de URL",
117-
failed_to_parse_url: "No se pudo analizar la URL",
118110
no_note_in_url: "No se encontró nota en la URL",
119-
decryption_failed: "Falló el descifrado",
120111
invalid_utf8: "Los datos descifrados no son UTF-8 válidos",
121-
crypto_error: "Error criptográfico",
122-
encoding_error: "Error de codificación",
112+
cipher_error: "Error de inicialización de cifrado",
113+
getrandom_error: "Error de generación de números aleatorios",
114+
base64_error: "Error de decodificación Base64",
115+
json_error: "Error de análisis JSON",
123116
utf8_error: "Error de codificación de texto",
124-
invalid_url_error: "Formato de URL inválido",
125-
missing_salt_error: "Falta sal de cifrado",
126-
invalid_encryption_mode_error: "Modo de cifrado inválido",
117+
qr_error: "Error de generación de código QR",
118+
encrypt_error: "Falló el cifrado",
119+
decrypt_error: "Falló el descifrado",
120+
url_error: "Formato de URL inválido",
127121
},
128122
Language::Russian => Translations {
129123
note_placeholder: "Введите вашу заметку здесь...",
@@ -143,19 +137,17 @@ pub fn get_translations(lang: Language) -> Translations {
143137
error_title: "Ошибка",
144138
loading: "Загрузка заметки...",
145139
password_required: "Для шифрования требуется пароль",
146-
encryption_failed: "Ошибка шифрования",
147-
qr_generation_failed: "Ошибка генерации QR-кода",
148-
url_generation_failed: "Ошибка генерации URL",
149-
failed_to_parse_url: "Не удалось разобрать URL",
150140
no_note_in_url: "Заметка не найдена в URL",
151-
decryption_failed: "Ошибка расшифровки",
152141
invalid_utf8: "Расшифрованные данные не являются допустимым UTF-8",
153-
crypto_error: "Криптографическая ошибка",
154-
encoding_error: "Ошибка кодирования",
142+
cipher_error: "Ошибка инициализации шифра",
143+
getrandom_error: "Ошибка генерации случайных чисел",
144+
base64_error: "Ошибка декодирования Base64",
145+
json_error: "Ошибка разбора JSON",
155146
utf8_error: "Ошибка кодировки текста",
156-
invalid_url_error: "Неверный формат URL",
157-
missing_salt_error: "Отсутствует соль шифрования",
158-
invalid_encryption_mode_error: "Неверный режим шифрования",
147+
qr_error: "Ошибка генерации QR-кода",
148+
encrypt_error: "Ошибка шифрования",
149+
decrypt_error: "Ошибка расшифровки",
150+
url_error: "Неверный формат URL",
159151
},
160152
}
161153
}

0 commit comments

Comments
 (0)