safely unwrap process error code
This commit is contained in:
parent
7f1fa73bb0
commit
d816309060
1 changed files with 3 additions and 3 deletions
|
|
@ -9,7 +9,7 @@ use std::sync::{Arc, Mutex};
|
||||||
use chrono::{DateTime, Utc};
|
use chrono::{DateTime, Utc};
|
||||||
use lapin::{Connection, ConnectionProperties, Consumer};
|
use lapin::{Connection, ConnectionProperties, Consumer};
|
||||||
use lapin::message::{Delivery, DeliveryResult};
|
use lapin::message::{Delivery, DeliveryResult};
|
||||||
use lapin::options::{BasicAckOptions, BasicConsumeOptions, BasicQosOptions};
|
use lapin::options::{BasicAckOptions, BasicConsumeOptions, BasicQosOptions, BasicRejectOptions};
|
||||||
use lapin::types::FieldTable;
|
use lapin::types::FieldTable;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use log::{error, info, trace, warn};
|
use log::{error, info, trace, warn};
|
||||||
|
|
@ -87,12 +87,12 @@ _|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_|"""""
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Ok(result) => {
|
Ok(result) => {
|
||||||
error!("Failed to transcribe {}, Exit code {}", &transcription_request.audio_file_path, result.status.code().unwrap());
|
error!("Failed to transcribe {}, Exit code {}", &transcription_request.audio_file_path, result.status.code().unwrap_or_else(|| -99));
|
||||||
error!("Stdout: {}", String::from_utf8_lossy(&result.stdout));
|
error!("Stdout: {}", String::from_utf8_lossy(&result.stdout));
|
||||||
error!("Stderr: {}", String::from_utf8_lossy(&result.stderr));
|
error!("Stderr: {}", String::from_utf8_lossy(&result.stderr));
|
||||||
|
|
||||||
delete_file(path);
|
delete_file(path);
|
||||||
return delivery.ack(BasicAckOptions::default()).await.unwrap();
|
return delivery.reject(BasicRejectOptions::default()).await.unwrap();
|
||||||
}
|
}
|
||||||
Err(error) => {
|
Err(error) => {
|
||||||
error!("Failed to transcribe {}, {}", &transcription_request.audio_file_path, error);
|
error!("Failed to transcribe {}, {}", &transcription_request.audio_file_path, error);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue