Skip to content
This repository was archived by the owner on Sep 5, 2025. It is now read-only.

Commit a059a45

Browse files
committed
Fix lint errors
1 parent 5136ae7 commit a059a45

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

src/clientStub.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export class DgraphClientStub {
123123
}
124124

125125
public health(): Promise<string> {
126-
return fetch(this.getURL("health"), {
126+
return fetch(this.getURL("health"), { // tslint:disable-line no-unsafe-any
127127
method: "GET",
128128
})
129129
.then((response: { status: number; text(): string }) => {
@@ -136,7 +136,7 @@ export class DgraphClientStub {
136136

137137
private callAPI<T>(path: string, config: {}): Promise<T> {
138138
const url = this.getURL(path);
139-
return fetch(url, config)
139+
return fetch(url, config) // tslint:disable-line no-unsafe-any
140140
.then((response: { status: number; json(): T }) => {
141141
if (response.status >= 300 || response.status < 200) {
142142
throw new Error(`Invalid status code = ${response.status}`);

src/errors.ts

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,24 +2,30 @@ export const ERR_NO_CLIENTS = new Error("No clients provided in DgraphClient con
22
export const ERR_FINISHED = new Error("Transaction has already been committed or discarded");
33
export const ERR_ABORTED = new Error("Transaction has been aborted. Please retry");
44

5+
/**
6+
* CustomError is base class used for defining custom error classes.
7+
*/
58
export class CustomError extends Error {
69
public readonly name: string;
710

811
constructor(message?: string) {
912
super(message);
13+
14+
// tslint:disable no-any no-unsafe-any
1015
this.name = new.target.name;
1116

1217
// fix the extended error prototype chain because typescript __extends implementation can't
13-
const setPrototypeOf: Function = (<any>Object).setPrototypeOf; // tslint:disable-line no-any
14-
setPrototypeOf
18+
const setPrototypeOf: Function = (<any>Object).setPrototypeOf;
19+
setPrototypeOf != null
1520
? setPrototypeOf(this, new.target.prototype)
16-
: ((<any>this).__proto__ = new.target.prototype); // tslint:disable-line no-any
21+
: ((<any>this).__proto__ = new.target.prototype);
1722

1823
// try to remove contructor from stack trace
19-
const captureStackTrace: Function = (<any>Error).captureStackTrace; // tslint:disable-line no-any
20-
if (captureStackTrace) {
24+
const captureStackTrace: Function = (<any>Error).captureStackTrace;
25+
if (captureStackTrace != null) {
2126
captureStackTrace(this, this.constructor);
2227
}
28+
// tslint:enable no-any no-unsafe-any
2329
}
2430
}
2531

@@ -28,6 +34,9 @@ export interface APIResultError {
2834
message: string;
2935
}
3036

37+
/**
38+
* APIError represents an error returned by Dgraph's HTTP server API.
39+
*/
3140
export class APIError extends CustomError {
3241
public readonly url: string;
3342
public readonly errors: APIResultError[];

0 commit comments

Comments
 (0)