refactor: centralize constants, eliminate unwraps, remove dead code, resolve TODOs
- R13+R16: Replace .expect() with .context()? in main.rs and identity.rs - R17+R18+R19: Fix unwrap() calls in helpers and js-engine - R20+R21: Remove #[allow(dead_code)] annotations and delete truly dead code - R22-R26: Create constants.rs module, replace 21 hardcoded values across 12 files - R28+R29: LND/DWN timeouts already present — verified - R30-R33: Remove TODO comments, implement marketplace payment check Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -127,7 +127,7 @@ impl ModuleLoader for ModsLoader {
|
||||
if referrer.contains("embassy") {
|
||||
bail!("Embassy.js cannot import anything else");
|
||||
}
|
||||
let s = resolve_import(specifier, referrer).unwrap();
|
||||
let s = resolve_import(specifier, referrer)?;
|
||||
Ok(s)
|
||||
}
|
||||
|
||||
@@ -246,7 +246,10 @@ impl JsExecutionEnvironment {
|
||||
}
|
||||
};
|
||||
let safer_handle = spawn_local(|| self.execute(procedure_name, input, variable_args)).await;
|
||||
let output = safer_handle.await.unwrap()?;
|
||||
let output = safer_handle.await.map_err(|e| {
|
||||
tracing::error!("JS execution task panicked: {}", e);
|
||||
(JsError::Engine, format!("JS execution task failed: {}", e))
|
||||
})??;
|
||||
match serde_json::from_value(output.clone()) {
|
||||
Ok(x) => Ok(x),
|
||||
Err(err) => {
|
||||
|
||||
Reference in New Issue
Block a user