composer: show error bubble on file upload error

This commit is contained in:
Simon Ser
2026-01-13 23:11:22 +01:00
parent 8aae4a2b07
commit 223b9b1531
2 changed files with 9 additions and 1 deletions

View File

@@ -220,6 +220,7 @@ export default class App extends Component {
this.handleAddNetworkClick = this.handleAddNetworkClick.bind(this);
this.handleNetworkSubmit = this.handleNetworkSubmit.bind(this);
this.handleNetworkRemove = this.handleNetworkRemove.bind(this);
this.showError = this.showError.bind(this);
this.handleDismissError = this.handleDismissError.bind(this);
this.handleAuthSubmit = this.handleAuthSubmit.bind(this);
this.handleRegisterSubmit = this.handleRegisterSubmit.bind(this);
@@ -2292,6 +2293,7 @@ export default class App extends Component {
client=${activeClient}
readOnly=${composerReadOnly}
onSubmit=${this.handleComposerSubmit}
onError=${this.showError}
autocomplete=${this.autocomplete}
commandOnly=${commandOnly}
maxLen=${privmsgMaxLen}

View File

@@ -185,7 +185,13 @@ export default class Composer extends Component {
promises.push(this.uploadFile(file));
}
let urls = await Promise.all(promises);
let urls;
try {
urls = await Promise.all(promises);
} catch (err) {
this.props.onError(new Error("Failed to upload files", { cause: err }));
return;
}
this.setState((state) => {
if (state.text) {