Skip to content

Commit

Permalink
#730: eslint --fix and improving error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
JoernBerkefeld committed May 29, 2023
1 parent bea3972 commit fc3286c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
12 changes: 6 additions & 6 deletions docs/dist/documentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -496,8 +496,8 @@ main class
* [.buildDefinition(businessUnit, selectedType, name, market)](#Mcdev.buildDefinition) ⇒ <code>Promise.&lt;void&gt;</code>
* [.buildDefinitionBulk(listName, type, name)](#Mcdev.buildDefinitionBulk) ⇒ <code>Promise.&lt;void&gt;</code>
* [.getFilesToCommit(businessUnit, selectedType, keyArr)](#Mcdev.getFilesToCommit) ⇒ <code>Promise.&lt;Array.&lt;string&gt;&gt;</code>
* [.execute(businessUnit, [selectedTypesArr], keys)](#Mcdev.execute) ⇒ <code>Promise.&lt;Boolean&gt;</code>
* [._executeBU(cred, bu, [selectedTypesArr], keyArr)](#Mcdev._executeBU) ⇒ <code>Promise.&lt;Boolean&gt;</code>
* [.execute(businessUnit, [selectedTypesArr], keys)](#Mcdev.execute) ⇒ <code>Promise.&lt;boolean&gt;</code>
* [._executeBU(cred, bu, [selectedTypesArr], keyArr)](#Mcdev._executeBU) ⇒ <code>Promise.&lt;boolean&gt;</code>

<a name="Mcdev.setSkipInteraction"></a>

Expand Down Expand Up @@ -752,11 +752,11 @@ Build a specific metadata file based on a template using a list of bu-market com

<a name="Mcdev.execute"></a>

### Mcdev.execute(businessUnit, [selectedTypesArr], keys) ⇒ <code>Promise.&lt;Boolean&gt;</code>
### Mcdev.execute(businessUnit, [selectedTypesArr], keys) ⇒ <code>Promise.&lt;boolean&gt;</code>
Start an item (query)

**Kind**: static method of [<code>Mcdev</code>](#Mcdev)
**Returns**: <code>Promise.&lt;Boolean&gt;</code> - true if all started successfully, false if not
**Returns**: <code>Promise.&lt;boolean&gt;</code> - true if all started successfully, false if not

| Param | Type | Description |
| --- | --- | --- |
Expand All @@ -766,11 +766,11 @@ Start an item (query)

<a name="Mcdev._executeBU"></a>

### Mcdev.\_executeBU(cred, bu, [selectedTypesArr], keyArr) ⇒ <code>Promise.&lt;Boolean&gt;</code>
### Mcdev.\_executeBU(cred, bu, [selectedTypesArr], keyArr) ⇒ <code>Promise.&lt;boolean&gt;</code>
helper for @link execute

**Kind**: static method of [<code>Mcdev</code>](#Mcdev)
**Returns**: <code>Promise.&lt;Boolean&gt;</code> - true if all items were executed, false otherwise
**Returns**: <code>Promise.&lt;boolean&gt;</code> - true if all items were executed, false otherwise

| Param | Type | Description |
| --- | --- | --- |
Expand Down
12 changes: 7 additions & 5 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -683,10 +683,11 @@ class Mcdev {
}
/**
* Start an item (query)
* @param {string} businessUnit name of BU
*
* @param {string} businessUnit name of BU
* @param {TYPE.SupportedMetadataTypes[]} [selectedTypesArr] limit to given metadata types
* @param {string[]} keys customerkey of the metadata
* @returns {Promise.<Boolean>} true if all started successfully, false if not
* @returns {Promise.<boolean>} true if all started successfully, false if not
*/
static async execute(businessUnit, selectedTypesArr, keys) {
Util.logger.info('mcdev:: Execute');
Expand Down Expand Up @@ -780,11 +781,12 @@ class Mcdev {
}
/**
* helper for @link execute
*
* @param {string} cred name of Credential
* @param {string} bu name of BU
* @param {TYPE.SupportedMetadataTypes[]} [selectedTypesArr] limit execution to given metadata type
* @param {string[]} keyArr customerkey of the metadata
* @returns {Promise.<Boolean>} true if all items were executed, false otherwise
* @returns {Promise.<boolean>} true if all items were executed, false otherwise
*/
static async _executeBU(cred, bu, selectedTypesArr, keyArr) {
const properties = await config.getProperties();
Expand All @@ -810,15 +812,15 @@ class Mcdev {
`\n :: Executing ${selectedTypesArr.join(', ')} on ${cred}/${bu}\n`
);
try {
//more than one type was provided, iterate types and execute items
// more than one type was provided, iterate types and execute items
for (const type of selectedTypesArr) {
try {
MetadataTypeInfo[type].client = auth.getSDK(buObject);
} catch (ex) {
Util.logger.error(ex.message);
return;
}
//result will be undefined (false) if execute is not supported for the type
// result will be undefined (false) if execute is not supported for the type
result = await MetadataTypeInfo[type].execute(keyArr);
}
} catch (ex) {
Expand Down
8 changes: 4 additions & 4 deletions lib/metadataTypes/MetadataType.js
Original file line number Diff line number Diff line change
Expand Up @@ -1091,15 +1091,15 @@ class MetadataType {
*/
static async executeREST(uri, key) {
try {
const response = await this.client.rest.post(uri, {}); //payload is empty for this request
const response = await this.client.rest.post(uri, {}); // payload is empty for this request
if (response === 'OK') {
Util.logger.info(`Executed ${this.definition.type} key: ${key}`);
} else {
throw new Error(`${this.definition.type} key: ${key} was not executed`);
throw new Error(`server response = (${response})`);
}
return response;
} catch {
Util.logger.error(`Failed to start ${this.definition.type} key: ${key}`);
} catch (ex) {
Util.logger.error(`Failed to start ${this.definition.type} ${key}: ${ex.message}`);
}
}

Expand Down

0 comments on commit fc3286c

Please sign in to comment.