@@ -33452,21 +33452,10 @@ async function loadBuildingBlockRunFromUrl(url, token, coreAdapter) {
3345233452 'Accept': 'application/vnd.meshcloud.api.meshbuildingblockrun.v1.hal+json',
3345333453 'Authorization': `Bearer ${token}`
3345433454 };
33455- try {
33456- const response = await axios_1.default.get(url, { headers });
33457- const buildingBlockRunJson = response.data;
33458- coreAdapter.debug(`Fetched Building Block Run: ${JSON.stringify(buildingBlockRunJson)}`);
33459- return buildingBlockRunJson;
33460- }
33461- catch (fetchError) {
33462- if ((0, error_utils_1.isAxiosError)(fetchError)) {
33463- (0, error_utils_1.logAxiosError)(fetchError, coreAdapter, 'Failed to fetch building block run');
33464- }
33465- else {
33466- coreAdapter.error(`Unexpected error during fetch: ${fetchError}`);
33467- }
33468- throw fetchError;
33469- }
33455+ const response = await axios_1.default.get(url, { headers });
33456+ const buildingBlockRunJson = response.data;
33457+ coreAdapter.debug(`Fetched Building Block Run: ${JSON.stringify(buildingBlockRunJson)}`);
33458+ return buildingBlockRunJson;
3347033459}
3347133460function extractInputs(buildingBlockRun, coreAdapter) {
3347233461 coreAdapter.debug('Extracting inputs from building block run');
@@ -33505,22 +33494,11 @@ function buildRequestPayload(steps, githubContext) {
3350533494async function registerSource(buildingBlockRunUrl, requestPayload, requestHeaders, tokenFilePath, coreAdapter) {
3350633495 coreAdapter.debug(`Request Payload: ${JSON.stringify(requestPayload)}`);
3350733496 coreAdapter.debug(`Request Headers: ${JSON.stringify(requestHeaders)}`);
33508- try {
33509- const response = await axios_1.default.post(`${buildingBlockRunUrl}/status/source`, requestPayload, {
33510- headers: requestHeaders
33511- });
33512- coreAdapter.setOutput('response', response.data);
33513- coreAdapter.setOutput('token_file', tokenFilePath);
33514- }
33515- catch (registerError) {
33516- if ((0, error_utils_1.isAxiosError)(registerError)) {
33517- (0, error_utils_1.logAxiosError)(registerError, coreAdapter, 'Failed to register source');
33518- }
33519- else {
33520- coreAdapter.error(`Unexpected error: ${registerError}`);
33521- }
33522- throw registerError;
33523- }
33497+ const response = await axios_1.default.post(`${buildingBlockRunUrl}/status/source`, requestPayload, {
33498+ headers: requestHeaders
33499+ });
33500+ coreAdapter.setOutput('response', response.data);
33501+ coreAdapter.setOutput('token_file', tokenFilePath);
3352433502}
3352533503async function runRegisterSource(coreAdapter = core, githubContext = github) {
3352633504 try {
@@ -33557,25 +33535,21 @@ async function runRegisterSource(coreAdapter = core, githubContext = github) {
3355733535 await registerSource(runUrl, requestPayload, requestHeaders, tokenFilePath, coreAdapter);
3355833536 }
3355933537 catch (error) {
33560- // Exception handler of last resort
33561- if (error instanceof Error) {
33562- coreAdapter.setFailed(error.message);
33538+ // Handle all errors at this level
33539+ if ((0, error_utils_1.isAxiosError)(error)) {
33540+ (0, error_utils_1.logAxiosError)(error, coreAdapter, 'Register source operation failed');
33541+ }
33542+ else if (error instanceof Error) {
33543+ coreAdapter.error(error.message);
3356333544 }
3356433545 else {
33565- coreAdapter.setFailed(`An unknown error occurred : ${error}`);
33546+ coreAdapter.error(`Unexpected error: ${error}`);
3356633547 }
33567- throw error;
33548+ coreAdapter.setFailed(error instanceof Error ? error.message : String(error)) ;
3356833549 }
3356933550}
3357033551async function run() {
33571- try {
33572- await runRegisterSource(core, github);
33573- }
33574- catch (error) {
33575- // Last-resort exception handler: prevent unhandled rejections
33576- // The error has already been logged and setFailed has been called
33577- process.exit(1);
33578- }
33552+ await runRegisterSource(core, github);
3357933553}
3358033554// Only run if this file is executed directly (not imported)
3358133555if (require.main === require.cache[eval('__filename')]) {
0 commit comments