@@ -16,6 +16,26 @@ const comittish = process.argv[4];
16
16
const repo = process . env . REPOSITORY_NAME
17
17
const owner = process . env . GITHUB_REPOSITORY_OWNER
18
18
19
+ function format_request_error ( error ) {
20
+ // Octokit promises that all errors are https://github.com/octokit/request-error.js
21
+ try {
22
+ let out = `${ error } (error ${ error . name } code ${ error . status } )` ;
23
+ if ( error . response ?. data ) {
24
+ // the response data is not the raw bytes we get from the server, but already
25
+ // preprocessed and typified object. There's *probably* not much extra info
26
+ // we can glean from this, but we shall try regardless
27
+ out += "\n" ;
28
+ let data = error . response . data ;
29
+ for ( let key of Object . keys ( data ) ) {
30
+ out += ` ${ key } : ${ data [ key ] } \n`
31
+ }
32
+ }
33
+ return out ;
34
+ } catch ( e ) {
35
+ return `${ error } ` ;
36
+ }
37
+ }
38
+
19
39
async function main ( ) {
20
40
const client = github . getOctokit ( token ) ;
21
41
@@ -28,9 +48,10 @@ async function main() {
28
48
'X-GitHub-Api-Version' : '2022-11-28' ,
29
49
} ,
30
50
}
31
- ) ;
51
+ ) . catch ( ( e ) => {
52
+ throw `${ format_request_error ( e ) } ...when getting latest release` ;
53
+ } )
32
54
33
- let previousTag = null ;
34
55
if ( latestReleaseResponse . data ) {
35
56
for ( const responseData of latestReleaseResponse . data ) {
36
57
if ( responseData . draft == false && responseData . prerelease == true ) {
@@ -52,7 +73,9 @@ async function main() {
52
73
'X-GitHub-Api-Version' : '2022-11-28' ,
53
74
} ,
54
75
}
55
- ) ;
76
+ ) . catch ( ( e ) => {
77
+ throw `${ format_request_error ( e ) } ...when asking github to autogenerate release notes since tag '${ previousTag } '` ;
78
+ } ) ;
56
79
57
80
const noteSections = response . data . body ?. split ( '\n\n' ) ;
58
81
const trimmedSections = [ ] ;
0 commit comments