atomicDEX-API icon indicating copy to clipboard operation
atomicDEX-API copied to clipboard

Komodefi shouldn't panic incase of bad `event_stream_configuration`

Open borngraced opened this issue 1 year ago • 1 comments

Screenshot 2024-04-30 at 13 35 22

currently, when Komodefi tries to parse incorrect event_stream_configuration, the program panics which doesn't sit well for me so I thought logging the error and continue with program is best

https://github.com/KomodoPlatform/komodo-defi-framework/blob/b0fd99e8406e67ea06435dd028991caa5f522b5c/mm2src/mm2_core/src/mm_ctx.rs#L725-L728

I guess this is better.

 let event_stream_configuration =
                    json::from_value(event_stream_configuration.clone());
                match event_stream_configuration {
                    Ok(config) => ctx.event_stream_configuration = Some(config),
                    Err(err) => {
                        error!("Bad/Invalid events streaming config, event streaming will be disregarded in this case: {err:?}");
                    }
                } 

cc @onur-ozkan

borngraced avatar Apr 30 '24 12:04 borngraced

I am fine with either way; I don't have strong opinions about this, but I would expect an app to fail initialization if it starts with incorrect configuration. When we make a breaking change in the configuration, as the logs can easily be missed, people should have their apps fail on start so they will be aware of the breaking change.

onur-ozkan avatar Apr 30 '24 14:04 onur-ozkan