Skip to content

Commit

Permalink
Return error on failure
Browse files Browse the repository at this point in the history
  • Loading branch information
urschrei committed Jul 1, 2024
1 parent e74ccfb commit 4248536
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/proj.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ pub enum ProjError {
DownloadError(String, String, u8),
#[error("The current definition could not be retrieved")]
Definition,
#[error("The definition could not be represented in the requested JSON format")]
ExportToJson,
}

#[cfg(feature = "network")]
Expand Down Expand Up @@ -1107,8 +1109,7 @@ impl Proj {
unsafe {
let out_ptr = proj_as_projjson(self.ctx, self.c_proj, opts_ptrs.as_ptr());
if out_ptr.is_null() {
// Not sure the best way to retrieve and return the error
todo!()
Err(ProjError::ExportToJson)
} else {
Ok(_string(out_ptr)?)
}
Expand Down

0 comments on commit 4248536

Please sign in to comment.