fix: some error handling and improvements#25
Open
gabyx wants to merge 2 commits into
Open
Conversation
95f816c to
e2e6181
Compare
cmdoret
reviewed
Oct 11, 2024
| // Shared app state built from config and used by services | ||
| #[derive(Clone, Debug)] | ||
| struct AppState { | ||
| // TODO: Add doc what these dict maps. |
Member
There was a problem hiding this comment.
Suggested change
| // TODO: Add doc what these dict maps. | |
| // collection name -> associated term matcher |
| struct Config { | ||
| host: String, | ||
| port: u16, | ||
| // TODO: Add doc what these dict maps. |
Member
There was a problem hiding this comment.
Suggested change
| // TODO: Add doc what these dict maps. | |
| // collection name -> list of ontology paths |
Comment on lines
+140
to
+149
| // TODO: This is unsafe: not sure what to do though -> maybe block the executor and set env | ||
| // variables before this asyn function is started. | ||
| // Strange that Rust compiled anyway, without the unsafe block, any idea? | ||
| unsafe { | ||
| env::set_var( | ||
| "RUST_LOG", | ||
| "fuzon_http=info,actix_web=warn,actix_server=info", | ||
| ); | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
question: how is this unsafe? If I remove the unsafe directive, everything works fine. This function is in a sync context and we only start the runtime after exporting, right?
| @@ -0,0 +1,7 @@ | |||
| #[derive(Debug, thiserror::Error, actix_web_error::Json)] | |||
| #[status(BAD_REQUEST)] // default status for all variants | |||
| pub enum ApiError { | |||
Member
There was a problem hiding this comment.
praise: very cool approach 💯
question: iiuc, as we expand the API, we would add variants for the different failure cases to this enum?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.