fix: Move an error condition earlier, before we try to do catalog work

If the command is going to fail anyway, may as well stop earlier
pull/24376/head
Carol (Nichols || Goulding) 2023-04-14 11:54:16 -04:00
parent 24e6248706
commit 8f17d217fb
No known key found for this signature in database
GPG Key ID: E907EE5A736F87D4
1 changed files with 7 additions and 7 deletions

View File

@ -118,6 +118,13 @@ pub async fn command(connection: Connection, config: Config) -> Result<(), Error
Ok(()) Ok(())
} }
Command::Pull(pull) => { Command::Pull(pull) => {
match &pull.object_store.object_store {
None | Some(ObjectStoreType::Memory | ObjectStoreType::MemoryThrottled) => {
return Err(Error::SillyObjectStoreConfig);
}
_ => {}
}
let metrics = setup_metric_registry(); let metrics = setup_metric_registry();
let catalog = pull.catalog_dsn.get_catalog("cli", metrics).await?; let catalog = pull.catalog_dsn.get_catalog("cli", metrics).await?;
let mut schema_client = schema::Client::new(connection.clone()); let mut schema_client = schema::Client::new(connection.clone());
@ -145,13 +152,6 @@ pub async fn command(connection: Connection, config: Config) -> Result<(), Error
let partition_mapping = let partition_mapping =
load_partition(&catalog, &schema, &pull.table, &partition).await?; load_partition(&catalog, &schema, &pull.table, &partition).await?;
match &pull.object_store.object_store {
None | Some(ObjectStoreType::Memory | ObjectStoreType::MemoryThrottled) => {
return Err(Error::SillyObjectStoreConfig);
}
_ => {}
}
let object_store = let object_store =
make_object_store(&pull.object_store).map_err(Error::ObjectStoreParsing)?; make_object_store(&pull.object_store).map_err(Error::ObjectStoreParsing)?;