From 2d608ee12e786b3583a21515664547b873f69991 Mon Sep 17 00:00:00 2001 From: Daniil Date: Wed, 30 Jun 2021 16:40:40 +0300 Subject: [PATCH 1/2] refactor: disconnected certain errors from tack.js, changed copy text --- src/botPage/view/blockly/index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/src/botPage/view/blockly/index.js b/src/botPage/view/blockly/index.js index 3a729696dc..c2df8619db 100644 --- a/src/botPage/view/blockly/index.js +++ b/src/botPage/view/blockly/index.js @@ -29,6 +29,7 @@ import GTM from '../../../common/gtm'; import { parseQueryString, isProduction } from '../../../common/utils/tools'; import { TrackJSError } from '../logger'; import { createDataStore } from '../../bot/data-collection'; +import { createError } from '../../common/error'; import config from '../../common/const'; const disableStrayBlocks = () => { @@ -200,10 +201,7 @@ export const load = (blockStr, dropEvent = {}) => { const blocklyXml = xml.querySelectorAll('block'); if (!blocklyXml.length) { - const error = new TrackJSError( - 'FileLoad', - translate('XML file contains unsupported elements. Please check or modify file.') - ); + const error = createError('EmptyXML', translate('XML file is empty. Please check or modify file.')); globalObserver.emit('Error', error); return; } @@ -239,9 +237,12 @@ export const load = (blockStr, dropEvent = {}) => { const blockType = block.getAttribute('type'); if (!Object.keys(Blockly.Blocks).includes(blockType)) { - const error = new TrackJSError( - 'FileLoad', - translate('XML file contains unsupported elements. Please check or modify file.') + const blockId = block.getAttribute('id'); + const error = createError( + 'InvalidBlockInXML', + translate( + `The block ${blockId} in the XML file contains unsupported elements.\nTo fix that open XML file in the text editor, search for block id ${blockId}, and check it's attributes for errors.` + ) ); globalObserver.emit('Error', error); throw error; From 8dd6f1fab2decebe16d3db49f3abd6df5513592d Mon Sep 17 00:00:00 2001 From: Daniil Date: Tue, 31 Aug 2021 11:07:47 +0300 Subject: [PATCH 2/2] feat: implemented approved copy text --- src/botPage/view/blockly/index.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/botPage/view/blockly/index.js b/src/botPage/view/blockly/index.js index c2df8619db..1fcb0f8165 100644 --- a/src/botPage/view/blockly/index.js +++ b/src/botPage/view/blockly/index.js @@ -241,7 +241,8 @@ export const load = (blockStr, dropEvent = {}) => { const error = createError( 'InvalidBlockInXML', translate( - `The block ${blockId} in the XML file contains unsupported elements.\nTo fix that open XML file in the text editor, search for block id ${blockId}, and check it's attributes for errors.` + `The file you’re trying to open contains unsupported elements in the following block: ${blockId} + Please check your file and try again.` ) ); globalObserver.emit('Error', error);