@@ -36,6 +36,9 @@ export async function bootstrapGlobal(input: {
3636 connectErrorTitle : string
3737 connectErrorDescription : string
3838 requestFailedTitle : string
39+ unknownError : string
40+ invalidConfigurationError : string
41+ formatMoreCount : ( count : number ) => string
3942 setGlobalStore : SetStoreFunction < GlobalStore >
4043} ) {
4144 const health = await input . globalSDK . global
@@ -88,8 +91,11 @@ export async function bootstrapGlobal(input: {
8891 const results = await Promise . allSettled ( tasks )
8992 const errors = results . filter ( ( r ) : r is PromiseRejectedResult => r . status === "rejected" ) . map ( ( r ) => r . reason )
9093 if ( errors . length ) {
91- const message = errors [ 0 ] instanceof Error ? errors [ 0 ] . message : String ( errors [ 0 ] )
92- const more = errors . length > 1 ? ` (+${ errors . length - 1 } more)` : ""
94+ const message = formatServerError ( errors [ 0 ] , {
95+ unknown : input . unknownError ,
96+ invalidConfiguration : input . invalidConfigurationError ,
97+ } )
98+ const more = errors . length > 1 ? input . formatMoreCount ( errors . length - 1 ) : ""
9399 showToast ( {
94100 variant : "error" ,
95101 title : input . requestFailedTitle ,
@@ -116,6 +122,8 @@ export async function bootstrapDirectory(input: {
116122 setStore : SetStoreFunction < State >
117123 vcsCache : VcsCache
118124 loadSessions : ( directory : string ) => Promise < void > | void
125+ unknownError : string
126+ invalidConfigurationError : string
119127} ) {
120128 if ( input . store . status !== "complete" ) input . setStore ( "status" , "loading" )
121129
@@ -137,7 +145,10 @@ export async function bootstrapDirectory(input: {
137145 showToast ( {
138146 variant : "error" ,
139147 title : `Failed to reload ${ project } ` ,
140- description : formatServerError ( err ) ,
148+ description : formatServerError ( err , {
149+ unknown : input . unknownError ,
150+ invalidConfiguration : input . invalidConfigurationError ,
151+ } ) ,
141152 } )
142153 input . setStore ( "status" , "partial" )
143154 return
0 commit comments