yeow-api 0.2.28 → 0.2.30

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 (2) hide show
  1. package/package.json +1 -1
  2. package/src/task.ts +6 -2
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "yeow-api",
3
- "version": "0.2.28",
3
+ "version": "0.2.30",
4
4
  "description": "Yeow API �?TypeScript OOP wrappers over the task protocol",
5
5
  "type": "module",
6
6
  "main": "./src/index.ts",
package/src/task.ts CHANGED
@@ -1,8 +1,12 @@
1
1
  export function post(type: string, params: Record<string, unknown> = {}, priority?: string): Promise<unknown> {
2
2
  return new Promise((resolve, reject) => {
3
3
  const cbId = (globalThis as any)._registerCallback((result: any) => {
4
- if (result?.err) reject(new Error(result.err));
5
- else resolve(result);
4
+ if (result?.err) {
5
+ const e = new Error(result.err);
6
+ const regStack = typeof (globalThis as any)._getCurrentCbStack === 'function' ? (globalThis as any)._getCurrentCbStack() : null;
7
+ if (regStack) e.stack += ' --- cb registered at ---\n' + regStack;
8
+ reject(e);
9
+ } else resolve(result);
6
10
  });
7
11
  const pld: Record<string, unknown> = { type, params, cb: cbId };
8
12
  if (priority) pld.priority = priority;