kopia lustrzana https://github.com/backface/turtlestitch
WIP show block calling a reportGetVar
rodzic
9ee9e02840
commit
7e537fc7ae
|
@ -4196,13 +4196,18 @@ BlockMorph.prototype.errorPic = function () {
|
||||||
// return a picture of myself, that approximately fits in "one line"
|
// return a picture of myself, that approximately fits in "one line"
|
||||||
// filter any blocks beneath me, so that users only see the first
|
// filter any blocks beneath me, so that users only see the first
|
||||||
// block that caused an error.
|
// block that caused an error.
|
||||||
if (this.nextBlock) {
|
var block = this;
|
||||||
var copy = this.fullCopy();
|
if (block.selector === 'reportGetVar') {
|
||||||
|
// if I am a single variable, show my caller in the output.
|
||||||
|
block = block.parent;
|
||||||
|
}
|
||||||
|
if (block.nextBlock) {
|
||||||
|
var copy = block.fullCopy();
|
||||||
copy.removeChild(copy.nextBlock());
|
copy.removeChild(copy.nextBlock());
|
||||||
return copy.fullImage();
|
return copy.fullImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
return this.fullImage();
|
return block.fullImage();
|
||||||
}
|
}
|
||||||
|
|
||||||
BlockMorph.prototype.fullImage = function () {
|
BlockMorph.prototype.fullImage = function () {
|
||||||
|
|
|
@ -1176,9 +1176,9 @@ Process.prototype.errorBubble = function (error, element) {
|
||||||
// above the text of error.
|
// above the text of error.
|
||||||
var errorMorph = new AlignmentMorph('column', 5),
|
var errorMorph = new AlignmentMorph('column', 5),
|
||||||
errorIsNested = isNil(element.world()),
|
errorIsNested = isNil(element.world()),
|
||||||
errorPrefix = errorIsNested ? localize('Inside a custom block') + ':\n' : '',
|
errorPrefix = errorIsNested ? `${localize('Inside a custom block')}:\n`: '',
|
||||||
errorMessage = new TextMorph(
|
errorMessage = new TextMorph(
|
||||||
errorPrefix + localize(error.name) + ':\n' + error.message,
|
`${errorPrefix}${localize(error.name)}:\n${localize(error.message)}`,
|
||||||
SyntaxElementMorph.prototype.fontSize
|
SyntaxElementMorph.prototype.fontSize
|
||||||
),
|
),
|
||||||
img, blockImage;
|
img, blockImage;
|
||||||
|
@ -1186,22 +1186,13 @@ Process.prototype.errorBubble = function (error, element) {
|
||||||
errorMorph.add(errorMessage);
|
errorMorph.add(errorMessage);
|
||||||
errorMorph.alpha = 0;
|
errorMorph.alpha = 0;
|
||||||
if (errorIsNested) {
|
if (errorIsNested) {
|
||||||
window.element = element;
|
errorMorph.text += `\n${localize('The error occured at:')}\n`;
|
||||||
img = element.errorPic();
|
img = element.errorPic();
|
||||||
blockImage = new Morph();
|
blockImage = new Morph();
|
||||||
blockImage.isCachingImage = true;
|
blockImage.isCachingImage = true;
|
||||||
blockImage.bounds.setWidth(img.width);
|
blockImage.setExtent(new Point(img.width, img.height));
|
||||||
blockImage.bounds.setHeight(img.height);
|
|
||||||
|
|
||||||
// blockImage.setExtent(new Point(img.width, img.height));
|
|
||||||
blockImage.cachedImage = img;
|
blockImage.cachedImage = img;
|
||||||
// blockImage.image = img;
|
|
||||||
// errorMessage.setTop(blockImage.height() + 2);
|
|
||||||
errorMorph.add(blockImage);
|
errorMorph.add(blockImage);
|
||||||
// errorMorph.setExtent(new Point(
|
|
||||||
// Math.max(blockImage.width(), errorMessage.width()),
|
|
||||||
// blockImage.height() + errorMessage.height()
|
|
||||||
// ));
|
|
||||||
errorMorph.fixLayout();
|
errorMorph.fixLayout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Ładowanie…
Reference in New Issue