-
Notifications
You must be signed in to change notification settings - Fork 186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve error management #4145
Comments
Steps
Actual services relationshipgraph TD;
check-api.service-->generic-request;
check-api.service-->wz-api-check;
saved-objects-->generic-request;
wz-request-->axios
generic-request-->axios
wz-api-check-->axios
|
1. wz-api-check: public/react-services/wz-api-check.jscheckStored methodUse tracecomponentDidMountcheckApi methodUse trace |
2. wz-request: public/react-services/wz-request.tsgenericReq methodUse tracecomponentDidMountremoveSampleDataSampleDataWarningcheckCurrentSecurityPlatformexistStatisticsIndicesstartConfigReportcsvReq methodUse traceapiReq methodUse trace
|
3. generic-request: /public/react-services/generic-request.jsrequest methodUse trace
|
4. saved-objects: /public/react-services/saved-objects.jsexistsIndexPattern methodUse tracegetExistingIndexPattern methodUse tracecreateSavedObject methodUse tracerefreshFieldsOfIndexPattern methodUse tracerefreshIndexPatterncreateWazuhIndexPattern |
Applied solution:
Flow with Error Factory Implementationgraph TD;
generic-request-->ThrowError
wz-request-->ThrowError
wz-api-check-->ThrowError
ThrowError-->ErrorFactory
ErrorFactory-->Error
Error-->ErrorOrchestrator
ErrorOrchestrator-->UI
ErrorOrchestrator-->Browser-Console
ErrorOrchestrator-->Logs
Iteration steps to cover all services and cases
Base Services
Services
|
This PR also resolves issue #4030 by implementing the use of the new Error Factory feature on root services
Issue screenshotSolution screenshotScreen.Recording.2022-06-02.at.14.05.42.movFor testing
|
Flow with Error Factory Implementationgraph TD;
generic-request-->ThrowError
wz-request-->ThrowError
wz-api-check-->ThrowError
ThrowError-->ErrorFactory
ErrorFactory-->Error
Error-->ErrorOrchestrator
ErrorOrchestrator-->UI
ErrorOrchestrator-->Browser-Console
ErrorOrchestrator-->Logs
Advantages
|
Next steps
Generic Error TypesEvalErrorCreates an instance representing an error that occurs regarding the global function eval(). RangeErrorCreates an instance representing an error that occurs when a numeric variable or parameter is outside its valid range. ReferenceErrorCreates an instance representing an error that occurs when de-referencing an invalid reference. SyntaxErrorCreates an instance representing a syntax error. TypeErrorCreates an instance representing an error that occurs when a variable or parameter is not of a valid type. URIErrorCreates an instance representing an error that occurs when encodeURI() or decodeURI() are passed invalid parameters. AggregateErrorCreates an instance representing several errors wrapped in a single error when multiple errors need to be reported by an operation, for example by Promise.any(). InternalError Non-StandardCreates an instance representing an error that occurs when an internal error in the JavaScript engine is thrown. E.g. "too much recursion". Error sources
|
Description
On this issue, we will analyze all the error treatments.
We need to find all the cases where we catch errors and decide how to throw them to other application methods.
In this issue, we want to improve the error management in our app.
We need to normalize and improve the treatment of errors.
Steps to find the issue scope:
Check all the current error treatment
The analysis was documented in the following issue comments:
Improve error management #4145 (comment)
Improve error management #4145 (comment)
Improve error management #4145 (comment)
Improve error management #4145 (comment)
Improve error management #4145 (comment)
Improve error management #4145 (comment)
Create a solution that solves all the current error treatment problems.
Implement a
first version of Error Handler
and document the solution. Added new global error treatment (client-side) #4163Replace the use of error orchestrator in error management solution
Apply the new error management solution to a known issue Uncaught (in promise) TypeError in Integrity monitoring inventory #5210
Attack the error sources and use typescript to make interfaces and create better type error management.
Related issue
The text was updated successfully, but these errors were encountered: