Skip to content

Commit e366a13

Browse files
authored
Merge pull request #9 from clearfeld/main
v0.8.0
2 parents f54b173 + 307857f commit e366a13

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

src-tauri/src/lib.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ struct HTTPAPIResponse {
4444

4545
#[derive(serde::Serialize)]
4646
struct HTTPAPIErrorResponse {
47-
error_code: i32,
47+
// TODO: should have an error type to help distungish between curl native errors and custom app logic errors
48+
error_code: Option<i32>,
4849
error_message: String,
4950
}
5051

@@ -66,7 +67,7 @@ fn http_request(
6667
// println!("{}, {}", url, url_encode);
6768

6869
let mut error_str: String = "".to_string();
69-
let mut error_code: i32 = -1;
70+
let mut error_code: Option<i32> = None;
7071

7172
match easy.url(
7273
// Setting - OFF
@@ -79,7 +80,7 @@ fn http_request(
7980
Err(e) => {
8081
return Err(HTTPAPIErrorResponse {
8182
error_code: error_code,
82-
error_message: format!("Test - {}", e.to_string()),
83+
error_message: format!("{}", e.to_string()),
8384
})
8485
}
8586
}
@@ -228,7 +229,7 @@ fn http_request(
228229
Err(e) => {
229230
return Err(HTTPAPIErrorResponse {
230231
error_code: error_code,
231-
error_message: format!("Test - {}", e.to_string()),
232+
error_message: format!("{}", e.to_string()),
232233
})
233234
}
234235
};
@@ -349,7 +350,7 @@ fn http_request(
349350
println!("Request failed: {}", err);
350351

351352
return Err(HTTPAPIErrorResponse {
352-
error_code: err.code(),
353+
error_code: Some(err.code()),
353354
error_message: err.to_string(),
354355
});
355356
}

0 commit comments

Comments
 (0)