@sasjs/adapter 3.10.5 → 3.10.8

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
@@ -87,5 +87,5 @@
87
87
  "https": "1.0.0",
88
88
  "tough-cookie": "4.0.0"
89
89
  },
90
- "version": "3.10.5"
90
+ "version": "3.10.8"
91
91
  }
@@ -28,7 +28,7 @@ export async function refreshTokensForSasjs(
28
28
  }
29
29
  })
30
30
  .catch((err) => {
31
- throw prefixMessage(err, 'Error while refreshing tokens')
31
+ throw prefixMessage(err, 'Error while refreshing tokens: ')
32
32
  })
33
33
 
34
34
  return authResponse
@@ -42,7 +42,7 @@ export async function refreshTokensForViya(
42
42
  )
43
43
  .then((res) => res.result)
44
44
  .catch((err) => {
45
- throw prefixMessage(err, 'Error while refreshing tokens')
45
+ throw prefixMessage(err, 'Error while refreshing tokens: ')
46
46
  })
47
47
 
48
48
  return authResponse
@@ -703,7 +703,14 @@ const parseError = (data: string) => {
703
703
  } catch (_) {}
704
704
 
705
705
  try {
706
+ // There are some edge cases in which the SAS mp_abort macro
707
+ // (https://core.sasjs.io/mp__abort_8sas.html) is unable to
708
+ // provide a clean exit. In this case the JSON response will
709
+ // be wrapped in >>weboutBEGIN<< and >>weboutEND<< strings.
710
+ // Therefore, if the first string exists, we won't throw an
711
+ // error just yet (the parser may yet throw one instead)
706
712
  const hasError =
713
+ !data?.match(/>>weboutBEGIN<</) &&
707
714
  !!data?.match(/Stored Process Error/i) &&
708
715
  !!data?.match(/This request completed with errors./i)
709
716
  if (hasError) {
@@ -141,7 +141,9 @@ export const convertToCSV = (
141
141
  )
142
142
  }
143
143
 
144
- return `.${value.toLowerCase()}`
144
+ const dot = value.includes('.') ? '' : '.'
145
+
146
+ return `${dot}${value.toLowerCase()}`
145
147
  }
146
148
 
147
149
  // if there any present, it should have preceding (") for escaping