Skip to content

Commit

Permalink
adding errorHandler for serverCall (#832)
Browse files Browse the repository at this point in the history
  • Loading branch information
ElenaOdnoshivkina authored Oct 11, 2021
1 parent b56e90c commit 0311639
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,10 @@ class KetcherBuilder {
})

this.editor = editor
this.editor.errorHandler = errorHandler
this.editor.errorHandler =
errorHandler && typeof errorHandler === 'function'
? errorHandler
: () => {}
this.formatterFactory = new FormatterFactory(structService!)
}

Expand Down
4 changes: 3 additions & 1 deletion packages/ketcher-react/src/script/ui/state/server/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,9 @@ export function serverCall(editor, server, method, options, struct) {
options.data
),
omit('data', options)
)
).catch(e => {
editor.errorHandler(e)
})
)
}

Expand Down

0 comments on commit 0311639

Please sign in to comment.