mirror of
https://github.com/kellyjonbrazil/jc.git
synced 2025-07-15 01:24:29 +02:00
change _meta to _jc_meta
This commit is contained in:
@ -232,13 +232,13 @@ Most parsers load all of the data from STDIN, parse it, then output the entire J
|
|||||||
|
|
||||||
#### Ignoring Errors
|
#### Ignoring Errors
|
||||||
|
|
||||||
You may want to ignore parsing errors when using streaming parsers since these may be used in long-lived processing pipelines and errors can break the pipe. To ignore parsing errors, use the `-qq` cli option or the `ignore_exceptions=True` argument with the `parse()` function. This will add a `_meta` object to the JSON output with a `success` attribute. If `success` is `true`, then there were no issues parsing the line. If `success` is `false`, then a parsing issue was found and `error` and `line` fields will be added to include a short error description and the contents of the unparsable line, respectively:
|
You may want to ignore parsing errors when using streaming parsers since these may be used in long-lived processing pipelines and errors can break the pipe. To ignore parsing errors, use the `-qq` cli option or the `ignore_exceptions=True` argument with the `parse()` function. This will add a `_jc_meta` object to the JSON output with a `success` attribute. If `success` is `true`, then there were no issues parsing the line. If `success` is `false`, then a parsing issue was found and `error` and `line` fields will be added to include a short error description and the contents of the unparsable line, respectively:
|
||||||
|
|
||||||
Successfully parsed line with `-qq` option:
|
Successfully parsed line with `-qq` option:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"command_data": "data",
|
"command_data": "data",
|
||||||
"_meta": {
|
"_jc_meta": {
|
||||||
"success": true
|
"success": true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -246,7 +246,7 @@ Successfully parsed line with `-qq` option:
|
|||||||
Unsuccessfully parsed line with `-qq` option:
|
Unsuccessfully parsed line with `-qq` option:
|
||||||
```json
|
```json
|
||||||
{
|
{
|
||||||
"_meta": {
|
"_jc_meta": {
|
||||||
"success": false,
|
"success": false,
|
||||||
"error": "error message",
|
"error": "error message",
|
||||||
"line": "original line data"
|
"line": "original line data"
|
||||||
|
@ -121,13 +121,15 @@ Returns:
|
|||||||
```python
|
```python
|
||||||
stream_success(output_line, ignore_exceptions)
|
stream_success(output_line, ignore_exceptions)
|
||||||
```
|
```
|
||||||
add _meta object to output line if -q (quiet) option is used
|
add _meta object to output line if -qq (ignore_exceptions) option is used
|
||||||
|
|
||||||
## stream_error
|
## stream_error
|
||||||
```python
|
```python
|
||||||
stream_error(e, ignore_exceptions, line)
|
stream_error(e, ignore_exceptions, line)
|
||||||
```
|
```
|
||||||
reraise the stream exception with annotation or print an error _meta field if ignore_exceptions=True
|
reraise the stream exception with annotation or print an error _jc_meta
|
||||||
|
field if ignore_exceptions=True
|
||||||
|
|
||||||
|
|
||||||
## timestamp
|
## timestamp
|
||||||
```python
|
```python
|
||||||
|
6
man/jc.1
6
man/jc.1
@ -493,7 +493,7 @@ Note: Streaming parsers cannot be used with the "magic" syntax
|
|||||||
|
|
||||||
\fBIgnoring Errors\fP
|
\fBIgnoring Errors\fP
|
||||||
|
|
||||||
You may want to ignore parsing errors when using streaming parsers since these may be used in long-lived processing pipelines and errors can break the pipe. To ignore parsing errors, use the \fB-qq\fP cli option. This will add a \fB_meta\fP object to the JSON output with a \fBsuccess\fP attribute. If \fBsuccess\fP is \fBtrue\fP, then there were no issues parsing the line. If \fBsuccess\fP is \fBfalse\fP, then a parsing issue was found and \fBerror\fP and \fBline\fP fields will be added to include a short error description and the contents of the unparsable line, respectively:
|
You may want to ignore parsing errors when using streaming parsers since these may be used in long-lived processing pipelines and errors can break the pipe. To ignore parsing errors, use the \fB-qq\fP cli option. This will add a \fB_jc_meta\fP object to the JSON output with a \fBsuccess\fP attribute. If \fBsuccess\fP is \fBtrue\fP, then there were no issues parsing the line. If \fBsuccess\fP is \fBfalse\fP, then a parsing issue was found and \fBerror\fP and \fBline\fP fields will be added to include a short error description and the contents of the unparsable line, respectively:
|
||||||
|
|
||||||
.RS
|
.RS
|
||||||
Successfully parsed line with \fB-qq\fP option:
|
Successfully parsed line with \fB-qq\fP option:
|
||||||
@ -502,7 +502,7 @@ Successfully parsed line with \fB-qq\fP option:
|
|||||||
|
|
||||||
"command_data": "data",
|
"command_data": "data",
|
||||||
|
|
||||||
"_meta": {
|
"_jc_meta": {
|
||||||
|
|
||||||
"success": true
|
"success": true
|
||||||
|
|
||||||
@ -515,7 +515,7 @@ Unsuccessfully parsed line with \fB-qq\fP option:
|
|||||||
.RS
|
.RS
|
||||||
{
|
{
|
||||||
|
|
||||||
"_meta": {
|
"_jc_meta": {
|
||||||
|
|
||||||
"success": false,
|
"success": false,
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user