Imporved logging and added debug information to get backtraces when errors are encountered
This commit is contained in:
		
							
								
								
									
										86
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										86
									
								
								Cargo.lock
									
									
									
										generated
									
									
									
								
							@@ -60,6 +60,9 @@ name = "anyhow"
 | 
				
			|||||||
version = "1.0.82"
 | 
					version = "1.0.82"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
 | 
					checksum = "f538837af36e6f6a9be0faa67f9a314f8119e4e4b5867c6ab40ed60360142519"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "backtrace",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "aquamarine"
 | 
					name = "aquamarine"
 | 
				
			||||||
@@ -493,9 +496,9 @@ checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "fastrand"
 | 
					name = "fastrand"
 | 
				
			||||||
version = "2.0.2"
 | 
					version = "2.1.0"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "658bd65b1cf4c852a3cc96f18a8ce7b5640f6b703f905c7d74532294c2a63984"
 | 
					checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "finl_unicode"
 | 
					name = "finl_unicode"
 | 
				
			||||||
@@ -677,9 +680,9 @@ dependencies = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "hashbrown"
 | 
					name = "hashbrown"
 | 
				
			||||||
version = "0.14.3"
 | 
					version = "0.14.5"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604"
 | 
					checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "ahash",
 | 
					 "ahash",
 | 
				
			||||||
 "allocator-api2",
 | 
					 "allocator-api2",
 | 
				
			||||||
@@ -945,9 +948,9 @@ checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "lock_api"
 | 
					name = "lock_api"
 | 
				
			||||||
version = "0.4.11"
 | 
					version = "0.4.12"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45"
 | 
					checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "autocfg",
 | 
					 "autocfg",
 | 
				
			||||||
 "scopeguard",
 | 
					 "scopeguard",
 | 
				
			||||||
@@ -1113,9 +1116,9 @@ checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "parking_lot"
 | 
					name = "parking_lot"
 | 
				
			||||||
version = "0.12.1"
 | 
					version = "0.12.2"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f"
 | 
					checksum = "7e4af0ca4f6caed20e900d564c242b8e5d4903fdacf31d3daf527b66fe6f42fb"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "lock_api",
 | 
					 "lock_api",
 | 
				
			||||||
 "parking_lot_core",
 | 
					 "parking_lot_core",
 | 
				
			||||||
@@ -1123,15 +1126,15 @@ dependencies = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "parking_lot_core"
 | 
					name = "parking_lot_core"
 | 
				
			||||||
version = "0.9.9"
 | 
					version = "0.9.10"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e"
 | 
					checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "cfg-if",
 | 
					 "cfg-if",
 | 
				
			||||||
 "libc",
 | 
					 "libc",
 | 
				
			||||||
 "redox_syscall",
 | 
					 "redox_syscall 0.5.1",
 | 
				
			||||||
 "smallvec",
 | 
					 "smallvec",
 | 
				
			||||||
 "windows-targets 0.48.5",
 | 
					 "windows-targets 0.52.5",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
@@ -1379,6 +1382,15 @@ dependencies = [
 | 
				
			|||||||
 "bitflags 1.3.2",
 | 
					 "bitflags 1.3.2",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[package]]
 | 
				
			||||||
 | 
					name = "redox_syscall"
 | 
				
			||||||
 | 
					version = "0.5.1"
 | 
				
			||||||
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
 | 
					checksum = "469052894dcb553421e483e4209ee581a45100d31b4018de03e5a7ad86374a7e"
 | 
				
			||||||
 | 
					dependencies = [
 | 
				
			||||||
 | 
					 "bitflags 2.5.0",
 | 
				
			||||||
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "regex"
 | 
					name = "regex"
 | 
				
			||||||
version = "1.10.4"
 | 
					version = "1.10.4"
 | 
				
			||||||
@@ -1504,9 +1516,9 @@ dependencies = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "rustix"
 | 
					name = "rustix"
 | 
				
			||||||
version = "0.38.33"
 | 
					version = "0.38.34"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "e3cc72858054fcff6d7dea32df2aeaee6a7c24227366d7ea429aada2f26b16ad"
 | 
					checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "bitflags 2.5.0",
 | 
					 "bitflags 2.5.0",
 | 
				
			||||||
 "errno",
 | 
					 "errno",
 | 
				
			||||||
@@ -1517,9 +1529,9 @@ dependencies = [
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "rustls"
 | 
					name = "rustls"
 | 
				
			||||||
version = "0.21.11"
 | 
					version = "0.21.12"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "7fecbfb7b1444f477b345853b1fce097a2c6fb637b2bfb87e6bc5db0f043fae4"
 | 
					checksum = "3f56a14d1f48b391359b22f731fd4bd7e43c97f3c50eee276f3aa09c94784d3e"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "log",
 | 
					 "log",
 | 
				
			||||||
 "ring",
 | 
					 "ring",
 | 
				
			||||||
@@ -1597,18 +1609,18 @@ checksum = "92d43fe69e652f3df9bdc2b85b2854a0825b86e4fb76bc44d945137d053639ca"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "serde"
 | 
					name = "serde"
 | 
				
			||||||
version = "1.0.198"
 | 
					version = "1.0.199"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "9846a40c979031340571da2545a4e5b7c4163bdae79b301d5f86d03979451fcc"
 | 
					checksum = "0c9f6e76df036c77cd94996771fb40db98187f096dd0b9af39c6c6e452ba966a"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "serde_derive",
 | 
					 "serde_derive",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "serde_derive"
 | 
					name = "serde_derive"
 | 
				
			||||||
version = "1.0.198"
 | 
					version = "1.0.199"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "e88edab869b01783ba905e7d0153f9fc1a6505a96e4ad3018011eedb838566d9"
 | 
					checksum = "11bd257a6541e141e42ca6d24ae26f7714887b47e89aa739099104c7e4d3b7fc"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "proc-macro2",
 | 
					 "proc-macro2",
 | 
				
			||||||
 "quote",
 | 
					 "quote",
 | 
				
			||||||
@@ -1721,9 +1733,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67"
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "socket2"
 | 
					name = "socket2"
 | 
				
			||||||
version = "0.5.6"
 | 
					version = "0.5.7"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "05ffd9c0a93b7543e062e759284fcf5f5e3b098501104bfbdde4d404db792871"
 | 
					checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "libc",
 | 
					 "libc",
 | 
				
			||||||
 "windows-sys 0.52.0",
 | 
					 "windows-sys 0.52.0",
 | 
				
			||||||
@@ -2520,41 +2532,19 @@ version = "1.5.1"
 | 
				
			|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9"
 | 
					checksum = "a44ab49fad634e88f55bf8f9bb3abd2f27d7204172a112c7c9987e01c1c94ea9"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "redox_syscall",
 | 
					 "redox_syscall 0.4.1",
 | 
				
			||||||
 "wasite",
 | 
					 "wasite",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "winapi"
 | 
					 | 
				
			||||||
version = "0.3.9"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419"
 | 
					 | 
				
			||||||
dependencies = [
 | 
					 | 
				
			||||||
 "winapi-i686-pc-windows-gnu",
 | 
					 | 
				
			||||||
 "winapi-x86_64-pc-windows-gnu",
 | 
					 | 
				
			||||||
]
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "winapi-i686-pc-windows-gnu"
 | 
					 | 
				
			||||||
version = "0.4.0"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "winapi-util"
 | 
					name = "winapi-util"
 | 
				
			||||||
version = "0.1.6"
 | 
					version = "0.1.8"
 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
				
			||||||
checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596"
 | 
					checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b"
 | 
				
			||||||
dependencies = [
 | 
					dependencies = [
 | 
				
			||||||
 "winapi",
 | 
					 "windows-sys 0.52.0",
 | 
				
			||||||
]
 | 
					]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[[package]]
 | 
					 | 
				
			||||||
name = "winapi-x86_64-pc-windows-gnu"
 | 
					 | 
				
			||||||
version = "0.4.0"
 | 
					 | 
				
			||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
 | 
					 | 
				
			||||||
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
[[package]]
 | 
					[[package]]
 | 
				
			||||||
name = "windows-sys"
 | 
					name = "windows-sys"
 | 
				
			||||||
version = "0.48.0"
 | 
					version = "0.48.0"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -6,7 +6,7 @@ edition = "2021"
 | 
				
			|||||||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
					# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
 | 
				
			||||||
 | 
					
 | 
				
			||||||
[profile.release]
 | 
					[profile.release]
 | 
				
			||||||
strip = true
 | 
					debug = 1
 | 
				
			||||||
lto = true
 | 
					lto = true
 | 
				
			||||||
codegen-units = 1
 | 
					codegen-units = 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -23,11 +23,14 @@ workspace = true
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
[dependencies]
 | 
					[dependencies]
 | 
				
			||||||
ahash = "0.8"
 | 
					ahash = "0.8"
 | 
				
			||||||
anyhow = "1"
 | 
					anyhow = { version = "1", features = ["backtrace"] }
 | 
				
			||||||
arrayvec = "0.7"
 | 
					arrayvec = "0.7"
 | 
				
			||||||
base64 = "0.22"
 | 
					base64 = "0.22"
 | 
				
			||||||
cryptography = { version = "0.1", path = "cryptography" }
 | 
					cryptography = { version = "0.1", path = "cryptography" }
 | 
				
			||||||
derive_more = { version = "0.99.17", default-features = false, features = ["deref", "display"] }
 | 
					derive_more = { version = "0.99", default-features = false, features = [
 | 
				
			||||||
 | 
					    "deref",
 | 
				
			||||||
 | 
					    "display",
 | 
				
			||||||
 | 
					] }
 | 
				
			||||||
dotenvy = "0.15"
 | 
					dotenvy = "0.15"
 | 
				
			||||||
entity = { version = "0.1", path = "entity" }
 | 
					entity = { version = "0.1", path = "entity" }
 | 
				
			||||||
futures = "0.3"
 | 
					futures = "0.3"
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,6 +13,7 @@ COPY . .
 | 
				
			|||||||
RUN cargo b -r
 | 
					RUN cargo b -r
 | 
				
			||||||
 | 
					
 | 
				
			||||||
FROM debian:stable-slim
 | 
					FROM debian:stable-slim
 | 
				
			||||||
 | 
					ENV RUST_BACKTRACE=1
 | 
				
			||||||
WORKDIR /app
 | 
					WORKDIR /app
 | 
				
			||||||
COPY --from=builder /app/target/release/pass_manager .
 | 
					COPY --from=builder /app/target/release/pass_manager .
 | 
				
			||||||
CMD [ "./pass_manager" ]
 | 
					CMD [ "./pass_manager" ]
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -40,7 +40,10 @@ pub enum CallbackCommand {
 | 
				
			|||||||
impl CallbackCommand {
 | 
					impl CallbackCommand {
 | 
				
			||||||
    pub fn from_query(q: CallbackQuery) -> Option<Self> {
 | 
					    pub fn from_query(q: CallbackQuery) -> Option<Self> {
 | 
				
			||||||
        q.message?;
 | 
					        q.message?;
 | 
				
			||||||
        q.data?.parse().inspect_err(|err| log::error!("{err}")).ok()
 | 
					        q.data?
 | 
				
			||||||
 | 
					            .parse()
 | 
				
			||||||
 | 
					            .inspect_err(|err| log::error!("{err:?}"))
 | 
				
			||||||
 | 
					            .ok()
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -15,7 +15,7 @@ pub async fn change_locale(
 | 
				
			|||||||
    let is_successful = new_locale
 | 
					    let is_successful = new_locale
 | 
				
			||||||
        .update(user_id, &db)
 | 
					        .update(user_id, &db)
 | 
				
			||||||
        .await
 | 
					        .await
 | 
				
			||||||
        .inspect_err(|err| log::error!("{err}"))
 | 
					        .inspect_err(|err| log::error!("{err:?}"))
 | 
				
			||||||
        .unwrap_or(false);
 | 
					        .unwrap_or(false);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if !is_successful {
 | 
					    if !is_successful {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -27,7 +27,7 @@ async fn get_master_pass(
 | 
				
			|||||||
            &locale.everything_was_deleted
 | 
					            &locale.everything_was_deleted
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        (Err(err), _) | (_, Err(err)) => {
 | 
					        (Err(err), _) | (_, Err(err)) => {
 | 
				
			||||||
            error!("{}", crate::Error::from(err));
 | 
					            error!("{:?}", crate::Error::from(err));
 | 
				
			||||||
            txn.rollback().await?;
 | 
					            txn.rollback().await?;
 | 
				
			||||||
            &locale.something_went_wrong
 | 
					            &locale.something_went_wrong
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,5 +1,4 @@
 | 
				
			|||||||
use crate::prelude::*;
 | 
					use crate::prelude::*;
 | 
				
			||||||
use anyhow::Result;
 | 
					 | 
				
			||||||
use entity::locale::LocaleType;
 | 
					use entity::locale::LocaleType;
 | 
				
			||||||
use log::error;
 | 
					use log::error;
 | 
				
			||||||
use std::future::Future;
 | 
					use std::future::Future;
 | 
				
			||||||
@@ -13,16 +12,16 @@ pub struct LocaleStore {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
impl LocaleStore {
 | 
					impl LocaleStore {
 | 
				
			||||||
    pub fn init() -> Result<()> {
 | 
					    pub fn init() {
 | 
				
			||||||
        let ru = serde_yaml::from_slice(include_bytes!("../locales/ru.yaml"))?;
 | 
					        let ru = serde_yaml::from_slice(include_bytes!("../locales/ru.yaml"))
 | 
				
			||||||
        let eng = serde_yaml::from_slice(include_bytes!("../locales/eng.yaml"))?;
 | 
					            .expect("Error parsing russian locale");
 | 
				
			||||||
 | 
					        let eng = serde_yaml::from_slice(include_bytes!("../locales/eng.yaml"))
 | 
				
			||||||
 | 
					            .expect("Error parsing english locale");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        assert!(
 | 
					        assert!(
 | 
				
			||||||
            LOCALES.set(Self { eng, ru }).is_ok(),
 | 
					            LOCALES.set(Self { eng, ru }).is_ok(),
 | 
				
			||||||
            "Locales are already intialized"
 | 
					            "Locales are already intialized"
 | 
				
			||||||
        );
 | 
					        );
 | 
				
			||||||
 | 
					 | 
				
			||||||
        Ok(())
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -154,7 +153,7 @@ impl LocaleTypeExt for LocaleType {
 | 
				
			|||||||
        match Self::get_from_db(from.id.0, db).await {
 | 
					        match Self::get_from_db(from.id.0, db).await {
 | 
				
			||||||
            Ok(Some(locale)) => return locale,
 | 
					            Ok(Some(locale)) => return locale,
 | 
				
			||||||
            Ok(None) => (),
 | 
					            Ok(None) => (),
 | 
				
			||||||
            Err(err) => error!("{err}"),
 | 
					            Err(err) => error!("{err:?}"),
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        from.language_code
 | 
					        from.language_code
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -87,9 +87,9 @@ fn get_dispatcher(
 | 
				
			|||||||
#[tokio::main]
 | 
					#[tokio::main]
 | 
				
			||||||
async fn main() -> Result<()> {
 | 
					async fn main() -> Result<()> {
 | 
				
			||||||
    let _ = dotenv();
 | 
					    let _ = dotenv();
 | 
				
			||||||
    pretty_env_logger::init();
 | 
					    pretty_env_logger::init_timed();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    locales::LocaleStore::init()?;
 | 
					    locales::LocaleStore::init();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    let token = env::var("TOKEN").expect("expected TOKEN in the enviroment");
 | 
					    let token = env::var("TOKEN").expect("expected TOKEN in the enviroment");
 | 
				
			||||||
    let database_url = env::var("DATABASE_URL").expect("expected DATABASE_URL in the enviroment");
 | 
					    let database_url = env::var("DATABASE_URL").expect("expected DATABASE_URL in the enviroment");
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -13,7 +13,12 @@ async fn check_master_pass(
 | 
				
			|||||||
) -> crate::Result<Option<String>> {
 | 
					) -> crate::Result<Option<String>> {
 | 
				
			||||||
    let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
 | 
					    let user_id = msg.from().ok_or(NoUserInfo)?.id.0;
 | 
				
			||||||
    let Some(model) = MasterPass::get(user_id, db).await? else {
 | 
					    let Some(model) = MasterPass::get(user_id, db).await? else {
 | 
				
			||||||
        error!("User was put into the GetMasterPass state with no master password set");
 | 
					        error!(
 | 
				
			||||||
 | 
					            "{:?}",
 | 
				
			||||||
 | 
					            anyhow::anyhow!(
 | 
				
			||||||
 | 
					                "User was put into the GetMasterPass state with no master password set"
 | 
				
			||||||
 | 
					            )
 | 
				
			||||||
 | 
					        );
 | 
				
			||||||
        return Ok(Some(locale.master_password_is_not_set.to_owned()));
 | 
					        return Ok(Some(locale.master_password_is_not_set.to_owned()));
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -47,7 +47,7 @@ impl MessageIds {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        let result = join!(self.delete(bot), send_request.send());
 | 
					        let result = join!(self.delete(bot), send_request.send());
 | 
				
			||||||
        if let Err(err) = result.0 {
 | 
					        if let Err(err) = result.0 {
 | 
				
			||||||
            log::error!("{err}");
 | 
					            log::error!("{err:?}");
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
        *self = Self::from(&result.1?);
 | 
					        *self = Self::from(&result.1?);
 | 
				
			||||||
        Ok(())
 | 
					        Ok(())
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user