@@ -22,6 +22,7 @@ interface UriRouteContext extends UriHandlerDeps {
2222}
2323
2424type UriRouteHandler = ( ctx : UriRouteContext ) => Promise < void > ;
25+ type CoderUriRoute = "open" | "openDevContainer" ;
2526
2627const routes : Readonly < Record < string , UriRouteHandler > > = {
2728 "/open" : handleOpen ,
@@ -48,7 +49,10 @@ export function registerUriHandler(deps: UriHandlerDeps): vscode.Disposable {
4849 } ) ;
4950 } catch ( error ) {
5051 const message = errToStr ( error , "No error message was provided" ) ;
51- output . warn ( `Failed to handle URI ${ uri . toString ( ) } : ${ message } ` ) ;
52+ output . warn ( "Failed to handle URI" , {
53+ ...summarizeUri ( uri ) ,
54+ error : message ,
55+ } ) ;
5256 vscodeProposed . window . showErrorMessage ( "Failed to handle URI" , {
5357 detail : message ,
5458 modal : true ,
@@ -67,6 +71,17 @@ function getRequiredParam(params: URLSearchParams, name: string): string {
6771 return value ;
6872}
6973
74+ function summarizeUri ( uri : vscode . Uri ) : Record < string , string | boolean > {
75+ const params = new URLSearchParams ( uri . query ) ;
76+ return {
77+ path : uri . path ,
78+ hasOwner : params . has ( "owner" ) ,
79+ hasWorkspace : params . has ( "workspace" ) ,
80+ hasAgent : params . has ( "agent" ) ,
81+ hasToken : params . has ( "token" ) ,
82+ } ;
83+ }
84+
7085async function handleOpen ( ctx : UriRouteContext ) : Promise < void > {
7186 const { params, serviceContainer, deploymentManager, commands } = ctx ;
7287
@@ -78,7 +93,7 @@ async function handleOpen(ctx: UriRouteContext): Promise<void> {
7893 params . has ( "openRecent" ) &&
7994 ( ! params . get ( "openRecent" ) || params . get ( "openRecent" ) === "true" ) ;
8095
81- await setupDeployment ( params , serviceContainer , deploymentManager ) ;
96+ await setupDeployment ( "open" , params , serviceContainer , deploymentManager ) ;
8297
8398 await commands . open ( {
8499 workspaceOwner : owner ,
@@ -108,7 +123,12 @@ async function handleOpenDevContainer(ctx: UriRouteContext): Promise<void> {
108123 ) ;
109124 }
110125
111- await setupDeployment ( params , serviceContainer , deploymentManager ) ;
126+ await setupDeployment (
127+ "openDevContainer" ,
128+ params ,
129+ serviceContainer ,
130+ deploymentManager ,
131+ ) ;
112132
113133 await commands . openDevContainer (
114134 owner ,
@@ -126,6 +146,7 @@ async function handleOpenDevContainer(ctx: UriRouteContext): Promise<void> {
126146 * and token storage. Throws if user cancels URL input or login fails.
127147 */
128148async function setupDeployment (
149+ route : CoderUriRoute ,
129150 params : URLSearchParams ,
130151 serviceContainer : ServiceContainer ,
131152 deploymentManager : Pick < DeploymentManager , "setDeployment" > ,
@@ -154,6 +175,14 @@ async function setupDeployment(
154175 }
155176
156177 const safeHostname = toSafeHost ( url ) ;
178+ const owner = params . get ( "owner" ) ?? "" ;
179+ const workspace = params . get ( "workspace" ) ?? "" ;
180+ serviceContainer . getLogger ( ) . info ( "Handling Coder URI" , {
181+ route,
182+ safeHostname,
183+ workspace : owner && workspace ? `${ owner } /${ workspace } ` : "" ,
184+ agent : params . get ( "agent" ) ?? "(unspecified)" ,
185+ } ) ;
157186
158187 const token : string | undefined = params . get ( "token" ) ?? undefined ;
159188 const result = await authTelemetry . traceLogin ( "uri" , ( ) =>
0 commit comments