finos / FDC3

An open standard for the financial desktop.
https://fdc3.finos.org
Other
201 stars 132 forks source link

GetOrCreateChannel() Error Messages #1383

Closed Charlotte981 closed 1 month ago

Charlotte981 commented 1 month ago

Question Area

Question

Just wanted to clarify as I was unsure from the specification, but if a user passes the channelId of a private channel to getOrCreateChannel(), should the response be the ChannelError.AccessDenied error message, rather than a new app channel with the given channelId? Otherwise there could be a situation where an app channel and a private channel have the same channelId, which becomes a problem when trying to call getCurrentContext() as the getCurrentContextRequestPayload only contains channelId and contextType.

openfin-johans commented 1 month ago

Hi @Charlotte981,

we actually discussed this when building the 2.0 conformance tests and made some mental notes to clarify but I fear that was never actioned.

@kriswest @robmoffat

Best regards,

Johan

Charlotte981 commented 1 month ago

Hi Johan,

Great, thank you for the clarification.

Kind regards, Charlotte

kriswest commented 1 month ago

All that the Standard docs say on this is that:

It is intended that Desktop Agent implementations: ... MUST prevent PrivateChannels from being retrieved via fdc3.getOrCreateChannel.

While ChannelError has the following definitions:

  /** SHOULD be returned when a request to join a user channel or to a retrieve
   *  a Channel object via the `joinUserChannel` or `getOrCreateChannel` methods
   *  of the DesktopAgent (`fdc3`) object is denied. 
   */
  AccessDenied = 'AccessDenied',

  /** SHOULD be returned when a channel cannot be created or retrieved via the
   *  `getOrCreateChannel` method of the DesktopAgent (`fdc3`).
   */
  CreationFailed = 'CreationFailed',

From the descriptions above, it's ambiguous which error should be returned. It's also not great that these are marked with SHOULD rather than MUST as that makes it only a recommendation rather than a requirement.

We could tighten this up by adding a clarifying sentence in the overview and PrivateChannel reference and we could clarify which error to use in that case. There are no further docs on the usage of either error anywhere in FDC3 beyond the above, with the Standard enerally stopping short and saying>

... the promise will be rejected with an Error with a message string from the ChannelError enumeration.

As this is vague I think we should convert this question into an issue to clarify the use of errors (on this topic and generally).