Skip to content

Commit 91ad1ec

Browse files
committed
Rename to InvalidArgumentError
1 parent 316de24 commit 91ad1ec

4 files changed

Lines changed: 12 additions & 12 deletions

File tree

mod.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ export type { Config } from "./src/config.ts";
22
export { config } from "./src/config.ts";
33

44
export {
5-
InvalidArgumentTypesError,
5+
InvalidArgumentError,
66
InvalidTimeoutError,
77
MissingApiKeyError,
88
} from "./src/errors.ts";

src/errors.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
export class InvalidArgumentTypesError extends Error {
1+
export class InvalidArgumentError extends Error {
22
constructor() {
3-
super("Provide the arguments with the correct type");
4-
Object.setPrototypeOf(this, InvalidArgumentTypesError.prototype);
3+
super("Arguments are missing or of incorrect type");
4+
Object.setPrototypeOf(this, InvalidArgumentError.prototype);
55
}
66
}
77

src/serpapi.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { EngineMap } from "./engines/engine_map.ts";
2-
import { InvalidArgumentTypesError } from "./errors.ts";
2+
import { InvalidArgumentError } from "./errors.ts";
33
import {
44
AccountApiParameters,
55
AccountInformation,
@@ -97,7 +97,7 @@ export function getJson<
9797
const [parameters, callback] = args;
9898
return _getJson(parameters, callback);
9999
} else {
100-
throw new InvalidArgumentTypesError();
100+
throw new InvalidArgumentError();
101101
}
102102
}
103103

@@ -181,7 +181,7 @@ export function getHtml<
181181
const [parameters, callback] = args;
182182
return _getHtml(parameters, callback);
183183
} else {
184-
throw new InvalidArgumentTypesError();
184+
throw new InvalidArgumentError();
185185
}
186186
}
187187

tests/serpapi_test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import {
2121
getHtml,
2222
getJson,
2323
getLocations,
24-
InvalidArgumentTypesError,
24+
InvalidArgumentError,
2525
InvalidTimeoutError,
2626
MissingApiKeyError,
2727
} from "../mod.ts";
@@ -238,12 +238,12 @@ describe("getJson", {
238238
assertRejects(
239239
// @ts-ignore testing invalid usage
240240
async () => await getJson("google"),
241-
InvalidArgumentTypesError,
241+
InvalidArgumentError,
242242
);
243243
assertRejects(
244244
// @ts-ignore testing invalid usage
245245
async () => await getJson(),
246-
InvalidArgumentTypesError,
246+
InvalidArgumentError,
247247
);
248248
});
249249

@@ -367,12 +367,12 @@ describe("getHtml", {
367367
assertRejects(
368368
// @ts-ignore testing invalid usage
369369
async () => await getHtml("google"),
370-
InvalidArgumentTypesError,
370+
InvalidArgumentError,
371371
);
372372
assertRejects(
373373
// @ts-ignore testing invalid usage
374374
async () => await getHtml(),
375-
InvalidArgumentTypesError,
375+
InvalidArgumentError,
376376
);
377377
});
378378

0 commit comments

Comments
 (0)