kopia lustrzana https://github.com/backface/turtlestitch
improved handling of user-defined errors and errors inside custom blocks
rodzic
9e9041ac5f
commit
f4d8639b8f
|
@ -6,6 +6,7 @@
|
|||
* **Notable Changes:**
|
||||
* same blocks with empty variadic inputs compare as equal regardless of their arity
|
||||
* made "When I receive any messagge" non-thread-safe by default (again) to enable tail recursive broadcasts
|
||||
* improved handling of user-defined errors and errors inside custom blocks
|
||||
* **Notable Fixes:**
|
||||
* fixed storing the stage name(s)
|
||||
* removed distinction between number and string keys in "analyze"
|
||||
|
@ -20,6 +21,7 @@
|
|||
* api: fixed variable binding when broadcasting through the API, thanks, Zak!
|
||||
* objects: fixed programmatically hiding palette blocks using the "hide variable" block, thanks, Zak!
|
||||
* threads, api: made "When I receive any messagge" non-thread-safe by default (again) to enable tail recursive broadcasts
|
||||
* threads, extensions: improved handling of user-defined errors and errors inside custom blocks
|
||||
|
||||
### 2022-01-02
|
||||
* store: fixed storing the stage name(s)
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
<script src="src/sketch.js?version=2021-11-03"></script>
|
||||
<script src="src/video.js?version=2019-06-27"></script>
|
||||
<script src="src/maps.js?version=2021-06-15"></script>
|
||||
<script src="src/extensions.js?version=2022-01-01"></script>
|
||||
<script src="src/extensions.js?version=2022-01-03"></script>
|
||||
<script src="src/xml.js?version=2021-07-05"></script>
|
||||
<script src="src/store.js?version=2022-01-02"></script>
|
||||
<script src="src/locale.js?version=2022-01-03"></script>
|
||||
|
|
|
@ -33,7 +33,7 @@ Color, Process, contains*/
|
|||
|
||||
/*jshint esversion: 11*/
|
||||
|
||||
modules.extensions = '2022-January-01';
|
||||
modules.extensions = '2022-January-03';
|
||||
|
||||
// Global stuff
|
||||
|
||||
|
@ -203,7 +203,7 @@ var SnapExtensions = {
|
|||
SnapExtensions.primitives.set(
|
||||
'err_error(msg)',
|
||||
function (msg) {
|
||||
throw new Error(msg);
|
||||
throw new Error(msg, {cause: 'user'});
|
||||
}
|
||||
);
|
||||
|
||||
|
|
|
@ -1214,7 +1214,7 @@ Process.prototype.errorBubble = function (error, element) {
|
|||
// above the text of error.
|
||||
var errorMorph = new AlignmentMorph('column', 5),
|
||||
errorIsNested = isNil(element.world()),
|
||||
errorPrefix = errorIsNested ? `${localize('Inside a custom block')}:\n`
|
||||
errorPrefix = errorIsNested ? `${localize('Inside a custom block')}\n`
|
||||
: '',
|
||||
errorMessage = new TextMorph(
|
||||
`${errorPrefix}${localize(error.name)}:\n${localize(error.message)}`,
|
||||
|
@ -1223,16 +1223,18 @@ Process.prototype.errorBubble = function (error, element) {
|
|||
blockToShow = element;
|
||||
|
||||
errorMorph.add(errorMessage);
|
||||
if (errorIsNested) {
|
||||
|
||||
if (errorIsNested && error.cause !== 'user') {
|
||||
if (blockToShow.selector === 'reportGetVar') {
|
||||
// if I am a single variable, show my caller in the output.
|
||||
blockToShow = blockToShow.parent;
|
||||
}
|
||||
errorMorph.text += `\n${localize('The error occured at:')}\n`;
|
||||
errorMorph.children[0].text += `\n${localize('The error occured at')}`;
|
||||
errorMorph.children[0].fixLayout();
|
||||
errorMorph.add(blockToShow.fullCopy());
|
||||
errorMorph.fixLayout();
|
||||
}
|
||||
|
||||
errorMorph.fixLayout();
|
||||
return errorMorph;
|
||||
};
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue