Skip to content

Commit 005e6d1

Browse files
remo-labremo-lab
authored andcommitted
fix(ui): handle FileReader errors in IO options dialog
1 parent 8e16302 commit 005e6d1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

packages/phoenix-ng/projects/phoenix-ui-components/lib/components/ui-menu/io-options/io-options-dialog/io-options-dialog.component.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,11 @@ export class IOOptionsDialogComponent implements OnInit {
259259
reader.onload = () => {
260260
callback(reader.result.toString(), file.name.split('.')[0]);
261261
};
262+
reader.onerror = () => {
263+
const errorMessage = `Failed to read file "${file.name}". The file may be corrupted, too large, or inaccessible.`;
264+
console.error('FileReader error:', reader.error);
265+
this.eventDisplay.getInfoLogger().add(errorMessage, 'Error');
266+
};
262267
reader.readAsText(file);
263268
}
264269
this.onClose();

0 commit comments

Comments
 (0)