Skip to content

Commit d653cf0

Browse files
committed
fix: Allow DOMException.
1 parent c0c8d05 commit d653cf0

File tree

3 files changed

+3
-1
lines changed

3 files changed

+3
-1
lines changed

source/rules/rxjsThrowErrorRule.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ export class Walker extends Lint.ProgramAwareRuleWalker {
8383
const typeChecker = this.getTypeChecker();
8484
const type = typeChecker.getTypeAtLocation(node.expression);
8585

86-
if (!isAny(type) && !couldBeType(type, "Error")) {
86+
if (!isAny(type) && !couldBeType(type, /^(Error|DOMException)$/)) {
8787
this.addFailureAtNode(node.expression, Rule.FAILURE_STRING);
8888
}
8989

test/v6/fixtures/throw-error/notified/fixture.ts.lint

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { throwError } from "rxjs";
33
const ob1 = throwError("Boom!");
44
~~~~~~~ [throw-error]
55
const ob2 = throwError(new Error("Boom!"));
6+
const ob3 = throwError(new DOMException("Boom!"));
67

78
// There will be no signature for callback and
89
// that should not effect and internal error.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const a = () => { throw "error"; };
22
~~~~~~~ [throw-error]
33
const b = () => { throw new Error("error"); };
4+
const c = () => { throw new DOMException("error"); };
45

56
[throw-error]: Passing non-Error values is forbidden

0 commit comments

Comments
 (0)