Improve try...catch block in copy-dialog.coffee