File tree Expand file tree Collapse file tree 1 file changed +12
-0
lines changed
Expand file tree Collapse file tree 1 file changed +12
-0
lines changed Original file line number Diff line number Diff line change @@ -150,12 +150,20 @@ async function importCsv() {
150150
151151 complete : async (results ) => {
152152 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+ });
153157 throw new Error (` CSV parsing errors: ${results .errors .map (e => e .message ).join (' , ' )} ` );
154158 }
155159 const data: Record <string , string []> = {};
156160 const rows = results .data as Record <string , string >[];
157161
158162 if (rows .length === 0 ) {
163+ adminforth .alert ({
164+ message: ` No data rows found in CSV ` ,
165+ variant: ' danger'
166+ });
159167 throw new Error (' No data rows found in CSV' );
160168 }
161169 Object .keys (rows [0 ]).forEach (column => {
@@ -172,6 +180,10 @@ async function importCsv() {
172180 inProgress .value = false ;
173181 },
174182 error : (error ) => {
183+ adminforth .alert ({
184+ message: ` CSV parsing errors: ${error .message }} ` ,
185+ variant: ' danger'
186+ });
175187 throw new Error (` Failed to parse CSV: ${error .message } ` );
176188 }
177189 });
You can’t perform that action at this time.
0 commit comments