Skip to content

Commit f94258a

Browse files
committed
Catch other jsonparse error msg; more reformatting
Signed-off-by: Tyler Ohlsen <ohltyler@amazon.com>
1 parent cea9bb6 commit f94258a

File tree

3 files changed

+4
-15
lines changed

3 files changed

+4
-15
lines changed

public/pages/workflow_detail/workflow_inputs/ingest_inputs/source_data_modal.tsx

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@ import {
2424
} from '@elastic/eui';
2525
import { JsonLinesField } from '../input_fields';
2626
import {
27-
customStringify,
2827
customStringifySingleLine,
2928
FETCH_ALL_QUERY_LARGE,
3029
IConfigField,

public/pages/workflow_detail/workflow_inputs/input_fields/json_lines_field.tsx

+4-12
Original file line numberDiff line numberDiff line change
@@ -55,16 +55,6 @@ export function JsonLinesField(props: JsonLinesFieldProps) {
5555
return (
5656
<Field name={props.fieldPath}>
5757
{({ field, form }: FieldProps) => {
58-
let errMsgToDisplay = undefined as string | undefined;
59-
if (validate) {
60-
if (customErrMsg) {
61-
errMsgToDisplay = customErrMsg;
62-
} else if (getIn(errors, field.name)) {
63-
errMsgToDisplay = getIn(errors, field.name);
64-
} else {
65-
errMsgToDisplay = undefined;
66-
}
67-
}
6858
return (
6959
<EuiCompressedFormRow
7060
fullWidth={true}
@@ -80,7 +70,7 @@ export function JsonLinesField(props: JsonLinesFieldProps) {
8070
) : undefined
8171
}
8272
helpText={props.helpText || undefined}
83-
error={errMsgToDisplay}
73+
error={validate ? customErrMsg : undefined}
8474
isInvalid={
8575
validate
8676
? getIn(errors, field.name) && getIn(touched, field.name)
@@ -122,7 +112,9 @@ export function JsonLinesField(props: JsonLinesFieldProps) {
122112
error,
123113
'message',
124114
'Invalid JSON'
125-
).replace(/^(.*?)\s+in JSON.*/, '$1')}`
115+
)
116+
.replace(/^(.*?)\s+in JSON.*/, '$1')
117+
.replace(/^(.*?)\s+after JSON.*/, '$1')}`
126118
);
127119
}
128120
}}

public/utils/utils.tsx

-2
Original file line numberDiff line numberDiff line change
@@ -185,8 +185,6 @@ export function prepareDocsForSimulate(
185185
_source: doc,
186186
});
187187
});
188-
console.log('docobs: ', docObjs);
189-
console.log('prepared docs: ', preparedDocs);
190188
return preparedDocs;
191189
}
192190

0 commit comments

Comments
 (0)