Skip to content
This repository has been archived by the owner on Apr 17, 2023. It is now read-only.

Latest commit

 

History

History
26 lines (18 loc) · 692 Bytes

no-throw.md

File metadata and controls

26 lines (18 loc) · 692 Bytes

No Throw (no-throw)

We use our ErrorHandler to handle warnings, errors and fatal errors, which reacts appropriately and unified to the severity. Therefore, this handler should always be used instead of throwing an error yourself.

Rule Details

Examples of incorrect code for this rule:

throw new Error('foo');
throw error;

Examples of correct code for this rule:

ErrorHandler.error({ code: FrontendErrorCodeEnum.BAD_HEX_COLOR, filename: 'ColorUtil.ts' });

When Not To Use It

For parts of the start-up process, for example our config. The ErrorHandler uses the config, and the config uses the ErrorHandler. This would create a recursive cycle.