How to use the @atomist/automation-client.logger.error function in @atomist/automation-client

To help you get started, we’ve selected a few @atomist/automation-client examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github atomist / sdm-pack-aspect / lib / tree / treeUtils.ts View on Github external
function checkNullChildrenInvariant(pt: PlantedTree): void {
    const haveNullChildren: SunburstTree[] = [];
    visit(pt.tree, (l, d) => {
        if (isSunburstTree(l) && l.children === null) {
            haveNullChildren.push(l);
        }
        return true;
    });
    // the tree counts depth from zero
    if (haveNullChildren.length > 0) {
        logger.error("Tree: " + JSON.stringify(pt.tree, undefined, 2));
        throw new Error(`${haveNullChildren.length} tree nodes have null children: ${JSON.stringify(haveNullChildren)}`);
    }
}
github atomist / sdm-core / lib / goal / container / docker.ts View on Github external
// ...so prepend any other command elements to args array
        if (container.args) {
            container.args.splice(0, 0, ...container.command.slice(1));
        } else {
            container.args = container.command.slice(1);
        }
    }
    const envs = (container.env || []).map(env => `--env=${env.name}=${env.value}`);
    const ports = (container.ports || []).map(port => `-p=${port.containerPort}`);
    const volumes: string[] = [];
    for (const vm of (container.volumeMounts || [])) {
        const volume = (registration.volumes || []).find(v => v.name === vm.name);
        if (!volume) {
            const msg = `Container '${container.name}' references volume '${vm.name}' which not provided in goal registration ` +
                `volumes: ${stringify(registration.volumes)}`;
            logger.error(msg);
            throw new Error(msg);
        }
        volumes.push(`--volume=${volume.hostPath.path}:${vm.mountPath}`);
    }
    return [
        ...entryPoint,
        ...envs,
        ...ports,
        ...volumes,
    ];
}
github atomist / sdm-core / lib / log / RolarProgressLog.ts View on Github external
body: {
                        host: os.hostname(),
                        content: postingLogs || [],
                    },
                    headers: { "Content-Type": "application/json" },
                    retry: {
                        retries: 0,
                    },
                    options: {
                        timeout: 2500,
                    },
                });
            } catch (err) {
                this.localLogs = postingLogs.concat(this.localLogs);
                if (!/timeout.*exceeded/i.test(err.message)) {
                    logger.error(err.message);
                } else {
                    logger.warn("Calling rolar timed out");
                }
            }
        }
        return Promise.resolve();
    }
github atomist / sdm-pack-spring / lib / java / deploy / MavenPerBranchSpringBootDeploymentGoal.ts View on Github external
childProcess.addListener("exit", async () => {
                if (this.options.successPatterns.some(successPattern => successPattern.test(stdout))) {
                    resolve(deployment);
                } else {
                    await reportFailureToUser(goalInvocation, stdout);
                    logger.error("Maven deployment failure vvvvvvvvvvvvvvvvvvvvvv");
                    logger.error("stdout:\n%s\nstderr:\n%s\n^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^", stdout, stderr);
                    reject(new Error("Maven deployment failure"));
                }
            });
            childProcess.addListener("error", reject);
github atomist / sdm-pack-aspect / lib / analysis / offline / spider / github / GitHubSpider.ts View on Github external
r.timestamp = new Date();
                });
                for (const newResult of newResults) {
                    yield dropIrrelevantFields(newResult);
                }
                logger.debug(`Looked at ${retrieved} repos of max ${criteria.maxRetrieved}...`);
                if (retrieved > criteria.maxRetrieved) {
                    break;
                }
                if (results.length > criteria.maxReturned) {
                    results = results.slice(0, criteria.maxReturned);
                    break;
                }
            }
        } catch (error) {
            logger.error("Error querying: ", error);
            return;
        }
    }
}
github atomist / sdm-core / lib / internal / preferences / FilePreferenceStore.ts View on Github external
private async doWithPreferenceFile(withPreferenceFile: WithPreferenceFile): Promise {
        await lock(this.filePath, { retries: 5 });
        const prefs = await this.read();
        let result;
        try {
            result = await withPreferenceFile(prefs);
            if (result.save) {
                await fs.writeJson(this.filePath, prefs);
            }
        } catch (e) {
            logger.error(`Operation on preference file failed: ${e.message}`);
        }
        await unlock(this.filePath);
        return result.value as V;
    }
github atomist / sdm-pack-aspect / lib / analysis / offline / spider / SpiderAnalyzer.ts View on Github external
fp.displayName = aspect.toDisplayableFingerprintName(toName(fp.type, fp.name));
                }
                if (!fp.displayValue && aspect.toDisplayableFingerprint) {
                    fp.displayValue = aspect.toDisplayableFingerprint(fp);
                }
                return fp;
            });
            return fps;
        });
        addTiming(aspect.name, timed.millis, timeRecorder);
        const result = !!timed.result ? toArray(timed.result) : [];
        tracking.completed(result.length);
        return result;
    } catch (err) {
        tracking.failed(err);
        logger.error("Please check your configuration of aspect %s.\n%s", aspect.name, err);
        return [];
    }
}
github atomist / sdm / src / internal / artifact / local / EphemeralLocalArtifactStore.ts View on Github external
public async checkout(url: string): Promise {
        const storedArtifact = await this.retrieve(url);
        if (!storedArtifact) {
            logger.error("No stored artifact for [%s]: Known=%s", url,
                this.entries.map(e => e.url).join(","));
            return Promise.reject(new Error("No artifact found"));
        }

        const local: DeployableArtifact = {
            ...storedArtifact.appInfo,
            ...parseUrl(storedArtifact.deploymentUnitUrl),
        };
        logger.info("EphemeralLocalArtifactStore: checking out %s at %j", url, local);
        return local;
    }
}
github atomist / sdm / lib / api-helper / goal / goalPreconditions.ts View on Github external
function satisfied(preconditionKey: SdmGoalKey, goalsForCommit: SdmGoalEvent[]): boolean {
    const preconditionGoal = mapKeyToGoal(goalsForCommit)(preconditionKey);
    if (!preconditionGoal) {
        logger.error("Precondition %s not found on commit", goalKeyString(preconditionKey));
        return true;
    }
    switch (preconditionGoal.state) {
        case SdmGoalState.failure:
        case SdmGoalState.skipped:
        case SdmGoalState.canceled:
        case SdmGoalState.stopped:
            logger.debug("Precondition %s in state %s, won't be met", goalKeyString(preconditionKey),
                preconditionGoal.state);
            return false;
        case SdmGoalState.planned:
        case SdmGoalState.requested:
        case SdmGoalState.waiting_for_approval:
        case SdmGoalState.approved:
        case SdmGoalState.waiting_for_pre_approval:
        case SdmGoalState.pre_approved: