@jd-data-limited/easy-fm 0.0.8 → 0.0.10

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.
Files changed (3) hide show
  1. package/index.js +3 -4
  2. package/index.ts +1 -1
  3. package/package.json +1 -1
package/index.js CHANGED
@@ -24,8 +24,7 @@ import * as https from "https";
24
24
  // @ts-ignore
25
25
  const errs = JSON.parse(fs.readFileSync(path.join(path.dirname(fileURLToPath(import.meta.url)), 'fmErrors.json')).toString());
26
26
  export default class FileMakerConnection {
27
- constructor() {
28
- }
27
+ constructor() { }
29
28
  get endpoint() {
30
29
  return `https://${this.hostname}/fmi/data/v2/databases/${encodeURI(this.database)}`;
31
30
  }
@@ -490,11 +489,11 @@ class find {
490
489
  }
491
490
  export class FMError extends Error {
492
491
  constructor(code, httpStatus, res) {
493
- super(code);
492
+ super(errs.find(err => err.e === code) || "Unknown error");
494
493
  this.httpStatus = httpStatus;
495
494
  this.res = res;
496
495
  this.code = typeof code === "string" ? parseInt(code) : code;
497
- this.message = errs.find(err => err.e === this.code) || "Unknown error";
496
+ Error.captureStackTrace(this, FMError);
498
497
  }
499
498
  }
500
499
  //
package/index.ts CHANGED
@@ -570,7 +570,7 @@ export class FMError extends Error {
570
570
  readonly message: string
571
571
 
572
572
  constructor(code, httpStatus, res) {
573
- super(errs.find(err => err.e === this.code) || "Unknown error");
573
+ super(errs.find(err => err.e === code) || "Unknown error");
574
574
  this.httpStatus = httpStatus
575
575
  this.res = res
576
576
  this.code = typeof code === "string" ? parseInt(code) : code
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@jd-data-limited/easy-fm",
3
- "version": "0.0.8",
3
+ "version": "0.0.10",
4
4
  "dependencies": {
5
5
  "@types/btoa": "^1.2.3",
6
6
  "@types/events": "^3.0.0",