@paddle/paddle-node-sdk
Version:
A Node.js SDK that you can use to integrate Paddle Billing with applications written in server-side JavaScript.
18 lines (17 loc) • 433 B
JavaScript
import { ApiError } from '../errors/generic.js';
export class BaseResource {
constructor(client) {
this.client = client;
}
handleError(error) {
if (error.error) {
throw new ApiError(error.error);
}
}
handleResponse(response) {
const entityResponse = response;
const error = response;
this.handleError(error);
return entityResponse.data;
}
}