@webpod/ps 0.0.0-beta.5 → 0.0.0-beta.6

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpod/ps",
3
- "version": "0.0.0-beta.5",
3
+ "version": "0.0.0-beta.6",
4
4
  "description": "A process lookup utility",
5
5
  "publishConfig": {
6
6
  "access": "public"
@@ -152,7 +152,8 @@ var _tree = ({
152
152
  if (typeof opts === "string" || typeof opts === "number") {
153
153
  return _tree({ opts: { pid: opts }, cb, sync });
154
154
  }
155
- const handle = (all) => {
155
+ const onError = (err) => cb(err);
156
+ const onData = (all) => {
156
157
  if (opts === void 0) return all;
157
158
  const { pid, recursive = false } = opts;
158
159
  const list = pickTree(all, pid, recursive);
@@ -161,10 +162,13 @@ var _tree = ({
161
162
  };
162
163
  try {
163
164
  const all = _lookup({ sync });
164
- return sync ? handle(all) : all.then(handle);
165
+ return sync ? onData(all) : all.then(onData, (err) => {
166
+ onError(err);
167
+ throw err;
168
+ });
165
169
  } catch (err) {
166
- cb(err);
167
- throw err;
170
+ onError(err);
171
+ return Promise.reject(err);
168
172
  }
169
173
  };
170
174
  var tree = (opts, cb) => __async(void 0, null, function* () {
@@ -91,7 +91,8 @@ var _tree = ({
91
91
  if (typeof opts === "string" || typeof opts === "number") {
92
92
  return _tree({ opts: { pid: opts }, cb, sync });
93
93
  }
94
- const handle = (all) => {
94
+ const onError = (err) => cb(err);
95
+ const onData = (all) => {
95
96
  if (opts === void 0) return all;
96
97
  const { pid, recursive = false } = opts;
97
98
  const list = pickTree(all, pid, recursive);
@@ -100,10 +101,13 @@ var _tree = ({
100
101
  };
101
102
  try {
102
103
  const all = _lookup({ sync });
103
- return sync ? handle(all) : all.then(handle);
104
+ return sync ? onData(all) : all.then(onData, (err) => {
105
+ onError(err);
106
+ throw err;
107
+ });
104
108
  } catch (err) {
105
- cb(err);
106
- throw err;
109
+ onError(err);
110
+ return Promise.reject(err);
107
111
  }
108
112
  };
109
113
  var tree = async (opts, cb) => _tree({ opts, cb });