@augment-vir/common 21.3.5 → 21.3.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.
@@ -54,7 +54,20 @@ function ensureErrorAndPrependMessage(maybeError, prependMessage) {
54
54
  exports.ensureErrorAndPrependMessage = ensureErrorAndPrependMessage;
55
55
  function wrapInTry(inputs) {
56
56
  try {
57
- return inputs.callback();
57
+ const returnValue = inputs.callback();
58
+ if (returnValue instanceof Promise) {
59
+ return returnValue.catch((error) => {
60
+ if (inputs.catchCallback) {
61
+ return inputs.catchCallback(error);
62
+ }
63
+ else {
64
+ return inputs.fallbackValue;
65
+ }
66
+ });
67
+ }
68
+ else {
69
+ return returnValue;
70
+ }
58
71
  }
59
72
  catch (error) {
60
73
  if (inputs.catchCallback) {
@@ -46,7 +46,20 @@ export function ensureErrorAndPrependMessage(maybeError, prependMessage) {
46
46
  }
47
47
  export function wrapInTry(inputs) {
48
48
  try {
49
- return inputs.callback();
49
+ const returnValue = inputs.callback();
50
+ if (returnValue instanceof Promise) {
51
+ return returnValue.catch((error) => {
52
+ if (inputs.catchCallback) {
53
+ return inputs.catchCallback(error);
54
+ }
55
+ else {
56
+ return inputs.fallbackValue;
57
+ }
58
+ });
59
+ }
60
+ else {
61
+ return returnValue;
62
+ }
50
63
  }
51
64
  catch (error) {
52
65
  if (inputs.catchCallback) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@augment-vir/common",
3
- "version": "21.3.5",
3
+ "version": "21.3.6",
4
4
  "homepage": "https://github.com/electrovir/augment-vir/tree/main/packages/common",
5
5
  "bugs": {
6
6
  "url": "https://github.com/electrovir/augment-vir/issues"