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

Daniil/disconnected certain errors from track.js, changed copy text #3345

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 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,13 @@ 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 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);
throw error;
Expand Down