Skip to content

Commit e42246a

Browse files
authored
don't hide get-file errors (#472)
1 parent 615833c commit e42246a

File tree

5 files changed

+5
-8
lines changed

5 files changed

+5
-8
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# 0.3.5
22

33
* Add in-depth tests for bill validation
4+
* Properly propagate and log errors when getting a file (e.g. an avatar)
45

56
# 0.3.4
67

crates/bcr-ebill-wasm/src/api/bill.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ impl Bill {
104104
let file_bytes = get_ctx()
105105
.bill_service
106106
.open_and_decrypt_attached_file(bill_id, file_name, &keys.private_key)
107-
.await
108-
.map_err(|_| Error::NotFound)?;
107+
.await?;
109108

110109
let content_type = detect_content_type_for_bytes(&file_bytes)
111110
.ok_or(Error::Validation(ValidationError::InvalidContentType))?;

crates/bcr-ebill-wasm/src/api/company.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,7 @@ impl Company {
4545
let file_bytes = get_ctx()
4646
.company_service
4747
.open_and_decrypt_file(id, file_name, &private_key)
48-
.await
49-
.map_err(|_| Error::NotFound)?;
48+
.await?;
5049
get_ctx().contact_service.get_contact(id).await?; // check if contact exists
5150

5251
let content_type = detect_content_type_for_bytes(&file_bytes)

crates/bcr-ebill-wasm/src/api/contact.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,7 @@ impl Contact {
3434
let file_bytes = get_ctx()
3535
.contact_service
3636
.open_and_decrypt_file(id, file_name, &private_key)
37-
.await
38-
.map_err(|_| service::Error::NotFound)?;
37+
.await?;
3938

4039
let content_type = detect_content_type_for_bytes(&file_bytes).ok_or(
4140
service::Error::Validation(ValidationError::InvalidContentType),

crates/bcr-ebill-wasm/src/api/identity.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,7 @@ impl Identity {
5050
let file_bytes = get_ctx()
5151
.identity_service
5252
.open_and_decrypt_file(&id, file_name, &private_key)
53-
.await
54-
.map_err(|_| Error::NotFound)?;
53+
.await?;
5554

5655
let content_type = detect_content_type_for_bytes(&file_bytes)
5756
.ok_or(Error::Validation(ValidationError::InvalidContentType))?;

0 commit comments

Comments
 (0)