Skip to content

Commit 56ff41d

Browse files
committed
Turn FirmwareModal.save() into an async method
This makes it easier to extend in the next commit.
1 parent e70fc41 commit 56ff41d

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/vm/overview/firmware.jsx

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,19 @@ class FirmwareModal extends React.Component {
5252
this.setState({ dialogError: text, dialogErrorDetail: detail });
5353
}
5454

55-
save() {
55+
async save() {
5656
const Dialogs = this.context;
5757
const vm = this.props.vm;
58-
domainSetOSFirmware({ connectionName: vm.connectionName, objPath: vm.id, loaderType: stateToXml(this.state.firmware) })
59-
.then(Dialogs.close, exc => this.dialogErrorSet(_("Failed to change firmware"), exc.message));
58+
try {
59+
await domainSetOSFirmware({
60+
connectionName: vm.connectionName,
61+
objPath: vm.id,
62+
loaderType: stateToXml(this.state.firmware)
63+
});
64+
Dialogs.close();
65+
} catch (exc) {
66+
this.dialogErrorSet(_("Failed to change firmware"), exc.message);
67+
}
6068
}
6169

6270
render() {

0 commit comments

Comments
 (0)