Closed benloh closed 1 year ago
In GitLab by @daveseah on Jul 19, 2022, 17:06
changed target branch from dev
to dev-next-gui
In GitLab by @daveseah on Jul 20, 2022, 13:37
added 2 commits
In GitLab by @daveseah on Jul 20, 2022, 14:23
added 1 commit
In GitLab by @daveseah on Jul 27, 2022, 10:56
changed target branch from dev-next-gui
to dev-next
In GitLab by @daveseah on Jul 27, 2022, 17:40
added 75 commits
dev-next
In GitLab by @daveseah on Jul 19, 2022, 17:06
Merges dev-next-gui-errhelp -> dev-next
WORK IN PROGRESS
WHAT IS THE ERROR MANAGER
The Error Manager is a module that is being designed to centralize capture, processing, and reporting of errors across GEMSTEP.
The Error Manager technically does the following:
With the above in place, we can do stuff like this:
DEVELOPMENT APPROACH
Because error management can significantly change workflow in unexpected ways, we're developing it in a separate branch:
dev-next-gui-errhelp
. This branch will track against the active branch used by the research team (dev-next-gui
at the time of this writing), merging in changes as they are made. This should result in an alternate branch that researchers can try out; if there is a consensus that it's ready for use, we can merge it quickly.This is a fairly complicated subject because of the number of error sources, their specific meaning, and context of operation; we are implementing a kind of 1980s style "expert system" using ad-hoc techniques. On the technical side, there is also inserting the additional code to check for errors programmatically, and handling cascading errors where an error may originate in one area and then cause a number of cascading failures in parallel. Determining which error is the "root cause" that should be reported to the user.
Right now we are just trying to catch them all; afterwards we can concentrate on providing the first-pass user experience:
This work will require a lot of coordination between the GUI, system, and research team to communicate what errors they are seeing and how they believe they should be handled.
INITIAL TECHNICAL DESIGN
copied from !245
reporting errors from code
First
import ERROR from 'modules/error-mgr'
in the module you're adding to the error reporting system.Your code can use
try/catch
with this format:The ERROR method logs the error and contextual information, and rethrows the passed
caught
error object back up the chain IF "system wide error handling" is enabled by theSYSTEM_ENABLE
flag defined in themodules/error-mgr
source. If this flag is off, the error is just logged by the error is not rethrown so things can sort of run further, but it's unlikely it will do so cleanly.After an error is logged, the system waits for 1500 milliseconds before throwing an overlay up on the browser window telling you that an error has occurred, and what to do about it.
checking error status (WIP)
For modules that care whether an error has happened or not, use code that look like this:
This awkward syntax is used to make two versions of the code that is run with the
try/catch
wrapper. ERR_MGR will be valid ifSYSTEM_ENABLE
is set true inmodules/error-mgr
, undefined if not. This isn't a great solution, so we'll see what we can do to make it more streamlined.CONDITIONS CURRENTLY CHECKED AND TRAPPED
Here are the current cases that the error manager is now trying to detect during operation
ManifestLoader JSON.parse()
with try/catch and report to ERROR manager (malformed JSON in gemprj)ProjectLoader JSON.parse()
with try/catch and report to ERROR manager (missinggemprj
fields)ValidateStatement
with try/catch for generic crash, forward bad VSDToken errors through ERROR managerTokenize
with try/catch forward to ERROR manager (mismatched blocks)Evaluate
with try/catch forward to ERROR manager (bad expression)CompileBlueprint
with try/catch and forward to ERROR manager (non-compiling syntactically-correct GEMSCRIPT)CompileScript
with try/catch and forward to ERROR manager (error in round script)