Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Catmandu::Fix::oops #334

Closed
wants to merge 1 commit into from
Closed

Add Catmandu::Fix::oops #334

wants to merge 1 commit into from

Conversation

nichtich
Copy link
Member

This fix throws an error with error messages passed as string and/or read from error field such as set with validators. An example is given in the SYNOPSIS. I'd further like to make this functionality more easily available via command line as discussed in #274.

@coveralls
Copy link

coveralls commented Feb 22, 2018

Coverage Status

Coverage increased (+0.02%) to 94.518% when pulling aa8375c on oops into e55ec00 on dev.

@phochste
Copy link
Member

What is the difference with Catmandu::Fix::error?

@nichtich
Copy link
Member Author

nichtich commented Feb 26, 2018

Catmandu::Fix::error results in a verbose error message to STDOUT such as:

$ catmandu convert Null to Null -fix 'error("messsage")'
Oops! One of your fixes threw an error...
Error: message at /home/voj/proj/Catmandu/lib/Catmandu/Fix/error.pm line 17.
Input:
$VAR1 = {};

Catmandu::Fix::oops only emits the actual error message to STDERR:

$ catmandu convert Null to Null -fix 'oops("messsage")'
message

Moreover the message does not need to be a fixed string but can be read from a field (see SYNOPSIS).

I would also be fine with replacing the current Catmandu::Fix::error with Catmandu::Fix::oops - this would slightly change existing behaviour of the error fix and extend its functionality.

@nics
Copy link
Member

nics commented Mar 1, 2018

A switch to make errors concise and syntax to get a value from a path are so useful I would like to implement them Catmandu wide. The first is trivial to implement.
The feature/data_path branch could implement the second quickly. The feature/path branch makes it easy to integrate these path related features more cleanly though.

@nichtich
Copy link
Member Author

This has already been solved.

@nichtich nichtich closed this Sep 22, 2021
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.

4 participants