@go-avro/avro-js 0.0.2-beta.20 → 0.0.2-beta.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -28,8 +28,8 @@ export class AvroQueryClient {
28
28
  }
29
29
  return null;
30
30
  };
31
- return this.config.authManager.accessToken().then(token => {
32
- return new Promise((resolve, reject) => {
31
+ return new Promise((resolve, reject) => {
32
+ this.config.authManager.accessToken().then(token => {
33
33
  const cancelErr = checkCancelled();
34
34
  if (cancelErr)
35
35
  return reject(cancelErr);
@@ -297,8 +297,7 @@ export class AvroQueryClient {
297
297
  return this._xhr('POST', `/email/${emailId}`, formData);
298
298
  }
299
299
  catch (error) {
300
- console.error('Failed to send email', error);
301
- throw error;
300
+ throw new StandardError(500, `Failed to send email: ${error}`);
302
301
  }
303
302
  }
304
303
  createBill(companyGuid, data) {
@@ -313,16 +312,11 @@ export class AvroQueryClient {
313
312
  users: data.users,
314
313
  due_date: data.due_date,
315
314
  };
316
- return this._fetch('POST', `/company/${companyGuid}/bills`, body)
317
- .then(response => {
318
- if (!response || !Array.isArray(response)) {
319
- throw new StandardError(400, 'Invalid bills response');
320
- }
321
- return response;
322
- })
323
- .catch(err => {
324
- console.error('Failed to create bill:', err);
325
- throw new StandardError(500, 'Failed to create bill');
326
- });
315
+ try {
316
+ return this._xhr('POST', `/company/${companyGuid}/bill`, body);
317
+ }
318
+ catch (error) {
319
+ throw new StandardError(500, `Failed to create bill: ${error}`);
320
+ }
327
321
  }
328
322
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@go-avro/avro-js",
3
- "version": "0.0.2-beta.20",
3
+ "version": "0.0.2-beta.22",
4
4
  "description": "JS client for Avro backend integration.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",