File tree 1 file changed +12
-0
lines changed
1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -150,12 +150,20 @@ async function importCsv() {
150
150
151
151
complete : async (results ) => {
152
152
if (results .errors .length > 0 ) {
153
+ adminforth .alert ({
154
+ message: ` CSV parsing errors at row ${results .errors [0 ]?.row + 1 || ' ?' }: ${results .errors [0 ]?.message || ' Unknown error' } ` ,
155
+ variant: ' danger'
156
+ });
153
157
throw new Error (` CSV parsing errors: ${results .errors .map (e => e .message ).join (' , ' )} ` );
154
158
}
155
159
const data: Record <string , string []> = {};
156
160
const rows = results .data as Record <string , string >[];
157
161
158
162
if (rows .length === 0 ) {
163
+ adminforth .alert ({
164
+ message: ` No data rows found in CSV ` ,
165
+ variant: ' danger'
166
+ });
159
167
throw new Error (' No data rows found in CSV' );
160
168
}
161
169
Object .keys (rows [0 ]).forEach (column => {
@@ -172,6 +180,10 @@ async function importCsv() {
172
180
inProgress .value = false ;
173
181
},
174
182
error : (error ) => {
183
+ adminforth .alert ({
184
+ message: ` CSV parsing errors: ${error .message }} ` ,
185
+ variant: ' danger'
186
+ });
175
187
throw new Error (` Failed to parse CSV: ${error .message } ` );
176
188
}
177
189
});
You can’t perform that action at this time.
0 commit comments