@@ -681,12 +681,12 @@ export class GitHubPullRequestApi extends Context.Service<
681681 readonly repository : string ;
682682 readonly checks : ReadonlyArray < ProviderCheckReference > ;
683683 readonly tailLines : number ;
684- } ) => Effect . Effect < ReadonlyArray < ProviderCheckLog > > ;
684+ } ) => Effect . Effect < ReadonlyArray < ProviderCheckLog > , GitHubPullRequestApiError > ;
685685 readonly rerunChecks : ( input : {
686686 readonly host : string ;
687687 readonly repository : string ;
688688 readonly checks : ReadonlyArray < ProviderCheckReference > ;
689- } ) => Effect . Effect < ReadonlyArray < ProviderCheckRerun > > ;
689+ } ) => Effect . Effect < ReadonlyArray < ProviderCheckRerun > , GitHubPullRequestApiError > ;
690690 readonly runPullRequestAction : ( input : {
691691 readonly cwd : string ;
692692 readonly repository : string ;
@@ -2770,14 +2770,24 @@ export const make = Effect.gen(function* () {
27702770 timeout : "60 seconds" ,
27712771 } )
27722772 . pipe (
2773- Effect . map ( ( response ) => ( {
2774- ...check ,
2775- ...tailLogLines ( response . body , input . tailLines ) ,
2776- detail : response . truncated ? "The log is too large; this is from its start." : null ,
2777- } ) ) ,
2778- Effect . catch ( ( error ) =>
2779- Effect . succeed ( { ...check , log : null , truncated : false , detail : error . message } ) ,
2780- ) ,
2773+ Effect . map ( ( response ) => {
2774+ const tail = tailLogLines ( response . body , input . tailLines ) ;
2775+ return {
2776+ ...check ,
2777+ log : tail . log ,
2778+ truncated : tail . truncated || response . truncated ,
2779+ detail : response . truncated
2780+ ? "The log is too large; this is from its start."
2781+ : null ,
2782+ } ;
2783+ } ) ,
2784+ // Sign-in and rate-limit failures fail the call; the rest are this check's.
2785+ Effect . catchTags ( {
2786+ GitHubApiNotFoundError : ( error ) =>
2787+ Effect . succeed ( { ...check , log : null , truncated : false , detail : error . message } ) ,
2788+ GitHubApiResponseError : ( error ) =>
2789+ Effect . succeed ( { ...check , log : null , truncated : false , detail : error . message } ) ,
2790+ } ) ,
27812791 ) ;
27822792 } ,
27832793 { concurrency : 4 } ,
@@ -2789,7 +2799,7 @@ export const make = Effect.gen(function* () {
27892799 const root = `repos/${ owner } /${ name } /actions` ;
27902800 const located = yield * Effect . forEach (
27912801 input . checks ,
2792- ( check ) : Effect . Effect < LocatedCheckJob > => {
2802+ ( check ) : Effect . Effect < LocatedCheckJob , GitHubPullRequestApiError > => {
27932803 const jobId = gitHubActionsJobId ( check . url ) ;
27942804 if ( jobId === null )
27952805 return Effect . succeed ( { check, jobId, runId : null , detail : NOT_A_JOB } ) ;
@@ -2798,9 +2808,13 @@ export const make = Effect.gen(function* () {
27982808 . pipe (
27992809 Effect . flatMap ( ( response ) => decodeActionsJob ( response . body ) ) ,
28002810 Effect . map ( ( job ) => ( { check, jobId, runId : job . run_id , detail : null } ) ) ,
2801- Effect . catch ( ( error ) =>
2802- Effect . succeed ( { check, jobId, runId : null , detail : error . message } ) ,
2803- ) ,
2811+ Effect . catchTags ( {
2812+ GitHubApiNotFoundError : ( error ) =>
2813+ Effect . succeed ( { check, jobId, runId : null , detail : error . message } ) ,
2814+ GitHubApiResponseError : ( error ) =>
2815+ Effect . succeed ( { check, jobId, runId : null , detail : error . message } ) ,
2816+ SchemaError : ( ) => Effect . succeed ( { check, jobId, runId : null , detail : NOT_A_JOB } ) ,
2817+ } ) ,
28042818 ) ;
28052819 } ,
28062820 { concurrency : 4 } ,
@@ -2826,8 +2840,11 @@ export const make = Effect.gen(function* () {
28262840 : `${ root } /runs/${ runId } /rerun-failed-jobs` ,
28272841 } )
28282842 . pipe (
2829- Effect . as ( null ) ,
2830- Effect . catch ( ( error ) => Effect . succeed ( error . message ) ) ,
2843+ Effect . as < string | null > ( null ) ,
2844+ Effect . catchTags ( {
2845+ GitHubApiNotFoundError : ( error ) => Effect . succeed ( error . message ) ,
2846+ GitHubApiResponseError : ( error ) => Effect . succeed ( error . message ) ,
2847+ } ) ,
28312848 Effect . map ( ( detail ) => outcomes . set ( runId , detail ) ) ,
28322849 ) ,
28332850 { concurrency : 2 , discard : true } ,
0 commit comments