create and save err if new image file is not successfully created #88
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What does this do?
Deals with Issue #65
Currently
create/2
andsave/2
fail silently if the file is not created as they don't check the result of theSystem.cmd
call.System.cmd
returns a tuple with the result and the command exit status, so by pattern matching the result ofcmd_mogrify
andcmd_convert
against a successful attempt ({_, 0}
) these functions will now raise an error for unsuccessful exist statuses.This is similar to the implementation for buffer in
create/2
.How to test?
Try to save a file with an illegal file type, and error should be raised.
What needs to be considered ?
It may be nice to have it throw a better error, but I'd leave the shape of that open for discussion