Skip to content

Commit 68d831c

Browse files
committed
Use ReplicateError for errors
1 parent 8228ec8 commit 68d831c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

lib/ReplicateClient.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ export default class ReplicateClient {
2525
{ defaultPollingInterval = 500 } = {}
2626
) {
2727
if (!version) {
28-
throw new Error("version is required");
28+
throw new ReplicateError("version is required");
2929
}
3030

3131
if (!input) {
32-
throw new Error("input is required");
32+
throw new ReplicateError("input is required");
3333
}
3434

3535
let prediction = await this.createPrediction(version, input);
@@ -85,7 +85,7 @@ export default class ReplicateClient {
8585
if (!resp.ok) {
8686
// TODO: Better error handling.
8787
console.error(await resp.text());
88-
throw new Error(resp.statusText);
88+
throw new ReplicateError(resp.statusText);
8989
}
9090

9191
try {
@@ -107,7 +107,7 @@ export default class ReplicateClient {
107107
const result = /^(GET|POST) (\/[^\s]+)$/.exec(action);
108108

109109
if (!result) {
110-
throw new Error(`Invalid action: ${action}`);
110+
throw new ReplicateError(`Invalid action: ${action}`);
111111
}
112112

113113
const [, method, path] = result;

0 commit comments

Comments
 (0)