1
0
mirror of https://github.com/sasjs/adapter.git synced 2025-12-11 09:24:35 +00:00

Compare commits

...

3 Commits

Author SHA1 Message Date
Yury Shkoda
0aa0ae65e0 Merge pull request #313 from sasjs/response-parsing-fix
fix(fetch-log): fixed response parsing
2021-03-30 11:12:40 +03:00
Yury Shkoda
4b0d62d59b Merge branch 'master' into response-parsing-fix 2021-03-30 11:07:37 +03:00
Yury Shkoda
b3ef50e9eb fix(fetch-log): fixed response parsing 2021-03-30 11:04:18 +03:00

View File

@@ -12,6 +12,7 @@ import {
ComputeJobExecutor, ComputeJobExecutor,
JesJobExecutor JesJobExecutor
} from './job-execution' } from './job-execution'
import { ErrorResponse } from './types/errors'
const defaultConfig: SASjsConfig = { const defaultConfig: SASjsConfig = {
serverUrl: '', serverUrl: '',
@@ -709,9 +710,27 @@ export default class SASjs {
* @param accessToken - an access token for an authorized user. * @param accessToken - an access token for an authorized user.
*/ */
public async fetchLogFileContent(logUrl: string, accessToken?: string) { public async fetchLogFileContent(logUrl: string, accessToken?: string) {
return await this.requestClient!.get(logUrl, accessToken).then((res) => return await this.requestClient!.get(logUrl, accessToken).then((res) => {
JSON.stringify(res.result) if (!res)
) return Promise.reject(
new ErrorResponse(
'Error while fetching log. Response was not provided.'
)
)
try {
const result = JSON.stringify(res.result)
return result
} catch (err) {
return Promise.reject(
new ErrorResponse(
'Error while fetching log. The result is not valid.',
err
)
)
}
})
} }
public getSasRequests() { public getSasRequests() {