Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ podman-compose -f etc/deploy/compose/compose.yaml up
Connect to PSQL:

```shell
env PGPASSWORD=eggs psql -U postgres -d trustify -h localhost -p 5432
env PGPASSWORD=trustify psql -U postgres -d trustify -h localhost -p 5432
```

If you don't have the `psql` command available, you can also use the `podman-compose` command:
Expand All @@ -174,7 +174,7 @@ Point the app at an external db:

```shell
cargo run --bin trustd api --help
RUST_LOG=info cargo run --bin trustd api --db-password eggs --devmode --auth-disabled
RUST_LOG=info cargo run --bin trustd api --db-password trustify --devmode --auth-disabled
```

## Notes on models
Expand Down
2 changes: 1 addition & 1 deletion etc/deploy/compose/compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ services:
ports:
- "5432:5432"
environment:
POSTGRES_PASSWORD: "eggs"
POSTGRES_PASSWORD: "trustify"
POSTGRES_DB: "trustify"
restart: always
19 changes: 8 additions & 11 deletions modules/fundamental/src/error.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use actix_web::{body::BoxBody, HttpResponse, ResponseError};
use langchain_rust::agent::AgentError;
use langchain_rust::chain::ChainError;
use langchain_rust::{agent::AgentError, chain::ChainError};
use sea_orm::DbErr;
use trustify_common::{decompress, error::ErrorInformation, id::IdError, purl::PurlErr};
use trustify_module_storage::service::StorageKeyError;
Expand Down Expand Up @@ -61,24 +60,22 @@ impl ResponseError for Error {
Self::NotFound(msg) => {
HttpResponse::NotFound().json(ErrorInformation::new("Not Found", msg))
}
Error::Ingestor(inner) => {
HttpResponse::BadRequest().json(ErrorInformation::new("Ingestor error", inner))
}
Error::Query(err) => {
Self::Ingestor(inner) => inner.error_response(),
Self::Query(err) => {
HttpResponse::BadRequest().json(ErrorInformation::new("Query error", err))
}
Error::IdKey(err) => HttpResponse::BadRequest().json(ErrorInformation::new("Key", err)),
Error::StorageKey(err) => {
Self::IdKey(err) => HttpResponse::BadRequest().json(ErrorInformation::new("Key", err)),
Self::StorageKey(err) => {
HttpResponse::BadRequest().json(ErrorInformation::new("Storage Key", err))
}
Error::Compression(decompress::Error::UnknownType) => {
Self::Compression(decompress::Error::UnknownType) => {
HttpResponse::UnsupportedMediaType()
.json(ErrorInformation::new("UnsupportedCompression", self))
}
Error::Compression(decompress::Error::PayloadTooLarge) => {
Self::Compression(decompress::Error::PayloadTooLarge) => {
HttpResponse::PayloadTooLarge().json(ErrorInformation::new("PayloadTooLarge", self))
}
Error::Compression(err) => {
Self::Compression(err) => {
HttpResponse::BadRequest().json(ErrorInformation::new("CompressionError", err))
}

Expand Down
1 change: 1 addition & 0 deletions modules/storage/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ tempfile = { workspace = true }
thiserror = { workspace = true }
tokio = { workspace = true, features = ["full"] }
tokio-util = { workspace = true, features = ["full"] }
tracing = { workspace = true }

[dev-dependencies]
rstest = { workspace = true }
Expand Down
2 changes: 2 additions & 0 deletions modules/storage/src/service/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ use tokio::{
io::AsyncWriteExt,
};
use tokio_util::io::ReaderStream;
use tracing::instrument;

/// A filesystem backed store
///
Expand Down Expand Up @@ -98,6 +99,7 @@ impl FileSystemBackend {
impl StorageBackend for FileSystemBackend {
type Error = std::io::Error;

#[instrument(skip(stream), err(Debug, level=tracing::Level::INFO))]
async fn store<E, S>(&self, stream: S) -> Result<StorageResult, StoreError<E, Self::Error>>
where
E: Debug,
Expand Down
2 changes: 2 additions & 0 deletions modules/storage/src/service/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use http::{header::CONTENT_ENCODING, HeaderMap, HeaderValue};
use s3::{creds::Credentials, error::S3Error, Bucket};
use std::{fmt::Debug, io, pin::pin, str::FromStr};
use tokio_util::io::{ReaderStream, StreamReader};
use tracing::instrument;

#[derive(Clone, Debug)]
pub struct S3Backend {
Expand Down Expand Up @@ -50,6 +51,7 @@ impl S3Backend {
impl StorageBackend for S3Backend {
type Error = Error;

#[instrument(skip(self, stream), err(Debug, level=tracing::Level::INFO))]
async fn store<E, S>(&self, stream: S) -> Result<StorageResult, StoreError<E, Self::Error>>
where
E: Debug,
Expand Down