Skip to content

feat: implement API for providing custom index#241

Open
vytautas-astrauskas-sensmetry wants to merge 1 commit intomainfrom
feat/custom-meta-index
Open

feat: implement API for providing custom index#241
vytautas-astrauskas-sensmetry wants to merge 1 commit intomainfrom
feat/custom-meta-index

Conversation

@vytautas-astrauskas-sensmetry
Copy link
Collaborator

No description provided.

Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Comment on lines +236 to +246
pub fn update_index(
&mut self,
new_index: IndexMap<String, String>,
) -> Result<(), LocalSrcError> {
let mut meta = self
.get_meta()?
.unwrap_or_else(InterchangeProjectMetadataRaw::default);
meta.index = new_index;
self.put_meta(&meta, true)?;
Ok(())
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this only uses .get_meta() and .put_meta() (and nothing specific to LocalSrcProject) it should go with the other utility functions in the ProjectMut trait.

Comment on lines +315 to +320
match project.update_index(rust_index) {
Ok(()) => {}
Err(e) => {
env.throw_exception(ExceptionKind::SysandException, e.to_string());
}
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
match project.update_index(rust_index) {
Ok(()) => {}
Err(e) => {
env.throw_exception(ExceptionKind::SysandException, e.to_string());
}
}
let _ = project
.update_index(rust_index)
.inspect_err(|e| env.throw_exception(ExceptionKind::SysandException, e.to_string()));

Maybe a bit simpler if no early return is needed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants