@@ -19,7 +19,10 @@ export class RemoteBackendUrlMissingError extends Schema.TaggedErrorClass<Remote
1919
2020export class RemotePairingUrlInvalidError extends Schema . TaggedErrorClass < RemotePairingUrlInvalidError > ( ) (
2121 "RemotePairingUrlInvalidError" ,
22- { cause : Schema . Defect ( ) } ,
22+ {
23+ cause : Schema . optional ( Schema . Defect ( ) ) ,
24+ protocol : Schema . optional ( Schema . String ) ,
25+ } ,
2326) {
2427 override get message ( ) : string {
2528 return "Pairing URL is invalid." ;
@@ -30,7 +33,8 @@ export class RemoteBackendUrlInvalidError extends Schema.TaggedErrorClass<Remote
3033 "RemoteBackendUrlInvalidError" ,
3134 {
3235 source : Schema . Literals ( [ "direct-host" , "hosted-pairing-host" ] ) ,
33- cause : Schema . Defect ( ) ,
36+ cause : Schema . optional ( Schema . Defect ( ) ) ,
37+ protocol : Schema . optional ( Schema . String ) ,
3438 } ,
3539) {
3640 override get message ( ) : string {
@@ -65,9 +69,6 @@ export const RemotePairingTargetError = Schema.Union([
6569] ) ;
6670export type RemotePairingTargetError = typeof RemotePairingTargetError . Type ;
6771
68- const createUnsupportedRemoteBackendProtocolError = ( url : URL ) : TypeError =>
69- new TypeError ( `Unsupported remote backend URL protocol: ${ url . protocol } ` ) ;
70-
7172const hasSupportedRemoteBackendProtocol = ( url : URL ) : boolean =>
7273 SUPPORTED_REMOTE_BACKEND_PROTOCOLS . has ( url . protocol ) ;
7374
@@ -93,7 +94,7 @@ const normalizeRemoteBaseUrl = (
9394 if ( ! hasSupportedRemoteBackendProtocol ( url ) ) {
9495 throw new RemoteBackendUrlInvalidError ( {
9596 source,
96- cause : createUnsupportedRemoteBackendProtocolError ( url ) ,
97+ protocol : url . protocol ,
9798 } ) ;
9899 }
99100 url . pathname = "/" ;
@@ -199,7 +200,7 @@ export const resolveRemotePairingTarget = (input: {
199200 }
200201 if ( ! hasSupportedRemoteBackendProtocol ( url ) ) {
201202 throw new RemotePairingUrlInvalidError ( {
202- cause : createUnsupportedRemoteBackendProtocolError ( url ) ,
203+ protocol : url . protocol ,
203204 } ) ;
204205 }
205206 const hostedPairingRequest = readHostedPairingRequest ( url ) ;
0 commit comments