Added error handling to query prettify to prevent event propagation

This commit is contained in:
Andrew Bastin
2020-03-05 14:24:48 -05:00
parent 7dd4db13a1
commit a9ba2b50f9

View File

@@ -151,8 +151,8 @@ export default {
name: "prettifyGQLQuery",
exec: () => this.prettifyQuery(),
bindKey: {
mac: "cmd-g",
win: "ctrl-g",
mac: "cmd-p",
win: "ctrl-p",
},
})
@@ -168,7 +168,12 @@ export default {
methods: {
prettifyQuery() {
this.value = gql.print(gql.parse(this.editor.getValue()))
try {
this.value = gql.print(gql.parse(this.editor.getValue()))
} catch (e) {
// Catching the exception to avoid the event to be passed to the browser
// Prevents the print dialog from appearing
}
},
defineTheme() {