@@ -99,6 +99,23 @@ const readNestedMessage = (
9999 return asString ( nested [ "message" ] )
100100}
101101
102+ const renderNestedStatusPayload = (
103+ payload : JsonValue ,
104+ object : JsonObject
105+ ) : string | null => {
106+ const nestedStatus = asObject ( object [ "status" ] )
107+ if ( nestedStatus === null ) {
108+ return null
109+ }
110+
111+ const renderedNestedStatus = renderGithubStatusLike ( nestedStatus )
112+ if ( renderedNestedStatus !== null ) {
113+ return renderedNestedStatus
114+ }
115+
116+ return readNestedMessage ( object , "status" ) ?? JSON . stringify ( payload , null , 2 )
117+ }
118+
102119export const renderJsonPayload = ( payload : JsonValue ) : string => {
103120 if ( typeof payload === "string" ) {
104121 return payload
@@ -119,13 +136,9 @@ export const renderJsonPayload = (payload: JsonValue): string => {
119136 return message
120137 }
121138
122- const nestedStatus = asObject ( object [ "status" ] )
139+ const nestedStatus = renderNestedStatusPayload ( payload , object )
123140 if ( nestedStatus !== null ) {
124- const renderedNestedStatus = renderGithubStatusLike ( nestedStatus )
125- if ( renderedNestedStatus !== null ) {
126- return renderedNestedStatus
127- }
128- return readNestedMessage ( object , "status" ) ?? JSON . stringify ( payload , null , 2 )
141+ return nestedStatus
129142 }
130143
131144 const nestedErrorMessage = readNestedMessage ( object , "error" )
0 commit comments