Skip to content
This repository has been archived by the owner on Feb 22, 2024. It is now read-only.

Commit

Permalink
refactor: disconnected certain errors from tack.js, changed copy text
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniil-Deriv committed Jul 1, 2021
1 parent 9fd07c2 commit 2d608ee
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions src/botPage/view/blockly/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = () => {
Expand Down Expand Up @@ -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;
}
Expand Down Expand Up @@ -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;
Expand Down

0 comments on commit 2d608ee

Please sign in to comment.