Skip to content

Commit 2de63dd

Browse files
authored
Merge pull request #4079 from processing/FES
adding FES overview closes #3371
2 parents b85b335 + 4267ea4 commit 2de63dd

File tree

1 file changed

+39
-1
lines changed

1 file changed

+39
-1
lines changed

src/core/error_helpers.js

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,46 @@
11
/**
22
* @for p5
33
* @requires core
4+
*
5+
* This is the main file for the Friendly Error System (FES). Here is a
6+
* brief outline of the functions called in this system.
7+
*
8+
* The FES may be invoked by a call to either (1) _validateParameters,
9+
* (2) _friendlyFileLoadError, (3) _friendlyError, or (4) helpForMisusedAtTopLevelCode.
10+
*
11+
* helpForMisusedAtTopLevelCode is called by this file on window load to check for use
12+
* of p5.js functions outside of setup() or draw()
13+
* Items 1-3 above are called by functions in the p5 library located in other files.
14+
*
15+
* _friendlyFileLoadError is called by the loadX() methods.
16+
* _friendlyError can be called by any function to offer a helpful error message.
17+
*
18+
* _validateParameters is called by functions in the p5.js API to help users ensure
19+
* ther are calling p5 function with the right parameter types. The property
20+
* disableFriendlyErrors = false can be set from a p5.js sketch to turn off parameter
21+
* checking. The call sequence from _validateParameters looks something like this:
22+
*
23+
* _validateParameters
24+
* lookupParamDoc
25+
* scoreOverload
26+
* testParamTypes
27+
* testParamType
28+
* getOverloadErrors
29+
* _friendlyParamError
30+
* ValidationError
31+
* report
32+
* friendlyWelcome
33+
*
34+
* The call sequences to _friendlyFileLoadError and _friendlyError are like this:
35+
* _friendlyFileLoadError
36+
* report
37+
*
38+
* _friendlyError
39+
* report
40+
*
41+
* report() is the main function that prints directly to console with the output
42+
* of the error helper message. Note: friendlyWelcome() also prints to console directly.
443
*/
5-
644
import p5 from './main';
745
import * as constants from './constants';
846

0 commit comments

Comments
 (0)