Skip to content

Commit 63ce561

Browse files
committed
replace report() with p5._friendlyError()
1 parent ec3b2b7 commit 63ce561

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

src/core/friendly_errors/fes_core.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -354,7 +354,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
354354
actualName: fxns[lowercase]
355355
});
356356

357-
report(msg, fxns[lowercase]);
357+
p5._friendlyError(msg, fxns[lowercase]);
358358
}
359359
}
360360
};
@@ -454,7 +454,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
454454
// a link to the reference documentation. In case of multiple matches,
455455
// this is already done in the suggestions variable, one link for each
456456
// suggestion.
457-
report(
457+
p5._friendlyError(
458458
msg,
459459
matchedSymbols.length === 1 ? matchedSymbols[0].name : undefined
460460
);
@@ -601,7 +601,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
601601
currentEntryPoint === 'preload' &&
602602
p5.prototype._preloadMethods[func] == null
603603
) {
604-
report(
604+
p5._friendlyError(
605605
translator('fes.wrongPreload', {
606606
func: func,
607607
location: locationObj
@@ -613,7 +613,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
613613
);
614614
} else {
615615
// Library error
616-
report(
616+
p5._friendlyError(
617617
translator('fes.libraryError', {
618618
func: func,
619619
location: locationObj
@@ -714,7 +714,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
714714
case 'INVALIDTOKEN': {
715715
let url =
716716
'https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Illegal_character#What_went_wrong';
717-
report(
717+
p5._friendlyError(
718718
translator('fes.globalErrors.syntax.invalidToken', {
719719
url
720720
})
@@ -724,7 +724,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
724724
case 'UNEXPECTEDTOKEN': {
725725
let url =
726726
'https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Unexpected_token#What_went_wrong';
727-
report(
727+
p5._friendlyError(
728728
translator('fes.globalErrors.syntax.unexpectedToken', {
729729
url
730730
})
@@ -735,7 +735,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
735735
let errSym = matchedError.match[1];
736736
let url =
737737
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Redeclared_parameter#what_went_wrong';
738-
report(
738+
p5._friendlyError(
739739
translator('fes.globalErrors.syntax.redeclaredVariable', {
740740
symbol: errSym,
741741
url
@@ -746,7 +746,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
746746
case 'MISSINGINITIALIZER': {
747747
let url =
748748
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Missing_initializer_in_const#what_went_wrong';
749-
report(
749+
p5._friendlyError(
750750
translator('fes.globalErrors.syntax.missingInitializer', {
751751
url
752752
})
@@ -756,7 +756,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
756756
case 'BADRETURNORYIELD': {
757757
let url =
758758
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Bad_return_or_yield#what_went_wrong';
759-
report(
759+
p5._friendlyError(
760760
translator('fes.globalErrors.syntax.badReturnOrYield', {
761761
url
762762
})
@@ -780,7 +780,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
780780
let url1 = 'https://p5js.org/examples/data-variable-scope.html';
781781
let url2 =
782782
'https://developer.mozilla.org/docs/Web/JavaScript/Reference/Errors/Not_Defined#What_went_wrong';
783-
report(
783+
p5._friendlyError(
784784
translator('fes.globalErrors.reference.notDefined', {
785785
url1,
786786
url2,
@@ -798,7 +798,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
798798
let errSym = matchedError.match[1];
799799
let url =
800800
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_access_lexical_declaration_before_init#what_went_wrong';
801-
report(
801+
p5._friendlyError(
802802
translator('fes.globalErrors.reference.cannotAccess', {
803803
url,
804804
symbol: errSym,
@@ -837,11 +837,11 @@ if (typeof IS_MINIFIED !== 'undefined') {
837837
// as a property of an object and when it's called independently.
838838
// Both have different explanations.
839839
if (splitSym.length > 1) {
840-
report(
840+
p5._friendlyError(
841841
translator('fes.globalErrors.type.notfuncObj', translationObj)
842842
);
843843
} else {
844-
report(
844+
p5._friendlyError(
845845
translator('fes.globalErrors.type.notfunc', translationObj)
846846
);
847847
}
@@ -855,7 +855,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
855855
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_access_property#what_went_wrong';
856856
let url2 =
857857
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/null';
858-
report(
858+
p5._friendlyError(
859859
translator('fes.globalErrors.type.readFromNull', {
860860
url1,
861861
url2,
@@ -875,7 +875,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
875875
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Cant_access_property#what_went_wrong';
876876
let url2 =
877877
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/undefined#description';
878-
report(
878+
p5._friendlyError(
879879
translator('fes.globalErrors.type.readFromUndefined', {
880880
url1,
881881
url2,
@@ -892,7 +892,7 @@ if (typeof IS_MINIFIED !== 'undefined') {
892892
case 'CONSTASSIGN': {
893893
let url =
894894
'https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Errors/Invalid_const_assignment#what_went_wrong';
895-
report(
895+
p5._friendlyError(
896896
translator('fes.globalErrors.type.constAssign', {
897897
url,
898898
location: locationObj

0 commit comments

Comments
 (0)