File tree Expand file tree Collapse file tree 1 file changed +22
-18
lines changed
Expand file tree Collapse file tree 1 file changed +22
-18
lines changed Original file line number Diff line number Diff line change 66 * LICENSE file in the root directory.
77 */
88
9- class RenderforestError extends Error {
10- constructor ( message ) {
11- super ( )
12- this . message = message
13- this . name = this . constructor . name
14- }
15- }
9+ const CUSTOM_ERRORS = [
10+ 'CharacterBasedDurationError' ,
11+ 'DurationGreaterThanMaxPossibleError' ,
12+ 'IconAdjustableError' ,
13+ 'MissingOrderError' ,
14+ 'RenderforestError' ,
15+ 'ScreenHasVideoAreaError' ,
16+ 'ScreenIdAlreadyExistsError'
17+ ]
1618
17- class MissingOrderError extends Error {
18- constructor ( message ) {
19- super ( )
20- this . message = message
21- this . name = this . constructor . name
22- }
23- }
19+ const ERRORS = CUSTOM_ERRORS . reduce ( ( acc , className ) => {
20+ acc [ className ] = ( {
21+ [ className ] : class extends Error {
22+ constructor ( msg ) {
23+ super ( msg )
24+ this . name = this . constructor . name
25+ }
26+ }
27+ } ) [ className ]
2428
25- module . exports = {
26- RenderforestError ,
27- MissingOrderError
28- }
29+ return acc
30+ } , { } )
31+
32+ module . exports = ERRORS
You can’t perform that action at this time.
0 commit comments