1
0
mirror of https://github.com/sasjs/adapter.git synced 2026-01-14 15:40:06 +00:00

fix(root-folder-not-found): create RootFolderNotFoundError class

This commit is contained in:
Krishna Acondy
2021-07-27 07:52:19 +01:00
parent 710056bded
commit 1ace15a308
8 changed files with 73 additions and 38 deletions

View File

@@ -1,4 +1,4 @@
import { isRelativePath, isUri, isUrl, rootFolderNotFound } from './utils'
import { isRelativePath, isUri, isUrl } from './utils'
import * as NodeFormData from 'form-data'
import {
Job,
@@ -11,7 +11,7 @@ import {
JobDefinition,
PollOptions
} from './types'
import { JobExecutionError } from './types/errors'
import { JobExecutionError, RootFolderNotFoundError } from './types/errors'
import { SessionManager } from './SessionManager'
import { ContextManager } from './ContextManager'
import { SasAuthResponse, MacroVar, AuthConfig } from '@sasjs/utils/types'
@@ -381,7 +381,11 @@ export class SASViyaApiClient {
)
const newFolderName = `${parentFolderPath.split('/').pop()}`
if (newParentFolderPath === '') {
rootFolderNotFound(parentFolderPath, this.serverUrl, accessToken)
throw new RootFolderNotFoundError(
parentFolderPath,
this.serverUrl,
accessToken
)
}
logger.info(
`Creating parent folder:\n'${newFolderName}' in '${newParentFolderPath}'`