feat: Capture unhandled errors by restructuring apps

This commit is contained in:
Faruk AYDIN
2022-10-21 19:03:24 +02:00
parent 525472d3e0
commit 9a743fb4a8
16 changed files with 92 additions and 76 deletions

View File

@@ -1,12 +1,11 @@
import {
IGlobalVariable,
ITriggerOutput,
} from '@automatisch/types';
import { IGlobalVariable, ITriggerOutput } from '@automatisch/types';
import getRepoOwnerAndRepo from '../../common/get-repo-owner-and-repo';
import parseLinkHeader from '../../../../helpers/parse-header-link';
function getPathname($: IGlobalVariable) {
const { repoOwner, repo } = getRepoOwnerAndRepo($.step.parameters.repo as string);
const { repoOwner, repo } = getRepoOwnerAndRepo(
$.step.parameters.repo as string
);
if (repoOwner && repo) {
return `/repos/${repoOwner}/${repo}/issues`;
@@ -35,8 +34,8 @@ const newIssues = async ($: IGlobalVariable) => {
const response = await $.http.get(pathname, { params });
links = parseLinkHeader(response.headers.link);
if (response.integrationError) {
issues.error = response.integrationError;
if (response.httpError) {
issues.error = response.httpError;
return issues;
}
@@ -44,7 +43,8 @@ const newIssues = async ($: IGlobalVariable) => {
for (const issue of response.data) {
const issueId = issue.id;
if (issueId <= Number($.flow.lastInternalId) && !$.execution.testRun) return issues;
if (issueId <= Number($.flow.lastInternalId) && !$.execution.testRun)
return issues;
const dataItem = {
raw: issue,