@@ -54,7 +54,7 @@ export function DatasetFromJSONForm(props: CreateDatasetFromJSONFormProps) {
54
54
const onSubmit = useCallback (
55
55
( data : CreateDatasetFromJSONParams ) => {
56
56
if ( ! jsonData ) {
57
- onDatasetCreateError ( new Error ( "No JSON data available " ) ) ;
57
+ onDatasetCreateError ( new Error ( "No JSON file has been uploaded " ) ) ;
58
58
return ;
59
59
}
60
60
@@ -71,7 +71,9 @@ export function DatasetFromJSONForm(props: CreateDatasetFromJSONFormProps) {
71
71
} )
72
72
. then ( ( response ) => {
73
73
if ( ! response . ok ) {
74
- throw new Error ( response . statusText || "Failed to create dataset" ) ;
74
+ throw onDatasetCreateError (
75
+ new Error ( response . statusText || "Failed to create dataset" )
76
+ ) ;
75
77
}
76
78
return response . json ( ) ;
77
79
} )
@@ -80,9 +82,6 @@ export function DatasetFromJSONForm(props: CreateDatasetFromJSONFormProps) {
80
82
name : data . name ,
81
83
id : res [ "data" ] [ "dataset_id" ] ,
82
84
} ) ;
83
- } )
84
- . catch ( ( error ) => {
85
- onDatasetCreateError ( error ) ;
86
85
} ) ;
87
86
} ,
88
87
[ onDatasetCreateError , onDatasetCreated , jsonData ]
@@ -112,7 +111,7 @@ export function DatasetFromJSONForm(props: CreateDatasetFromJSONFormProps) {
112
111
value = { value . toString ( ) }
113
112
>
114
113
< Label > Dataset Name</ Label >
115
- < Input placeholder = "e.x. Golden Dataset" />
114
+ < Input placeholder = "e.g., Golden Dataset" />
116
115
{ error ?. message ? (
117
116
< FieldError > { error . message } </ FieldError >
118
117
) : (
@@ -135,7 +134,7 @@ export function DatasetFromJSONForm(props: CreateDatasetFromJSONFormProps) {
135
134
value = { value . toString ( ) }
136
135
>
137
136
< Label > Description</ Label >
138
- < TextArea placeholder = "e.x. A dataset for structured data extraction" />
137
+ < TextArea placeholder = "e.g., A dataset for structured data extraction" />
139
138
{ error ?. message ? (
140
139
< FieldError > { error . message } </ FieldError >
141
140
) : (
0 commit comments