connortsui20 commented on code in PR #965: URL: https://github.com/apache/iceberg-rust/pull/965#discussion_r1957526271
########## crates/catalog/rest/src/catalog.rs: ########## @@ -507,78 +530,98 @@ impl Catalog for RestCatalog { }) .build()?; - let resp = self - .context() - .await? - .client - .query::<LoadTableResponse, ErrorResponse>(request) - .await?; + let handler = |response: Response| async move { + match response.status() { + StatusCode::OK => { + Ok(deserialize_catalog_response::<LoadTableResponse>(response).await?) + } + StatusCode::NOT_FOUND => Err(Error::new( + ErrorKind::Unexpected, + "Tried to create a table under a namespace that does not exist", + )), + StatusCode::CONFLICT => Err(Error::new( + ErrorKind::Unexpected, Review Comment: Maybe this should be in a different PR? I'm willing to head a PR to add a sub enum into `ErrorKind` that states things that can go wrong (though that would definitely be a breaking change) -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org