Define error response message format - closes #67 #76
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Closes #67.
This PR defines a format for error message responses.
As in the strawman proposal the Problem Details Format is used for error messages.
Unlike the strawman proposal (but as discussed in #42), rather than having a dedicated
messageType
, themessageType
is set toresponse
and theoperation
member set to the name of the operation being carried out when the error was experienced then anerror
member contains the error information.I have re-used the same set of HTTP error codes recommended in WoT Profiles, with the exception of
401 Unauthorized
which would make more sense when opening the WebSocket connection rather than once the connection is already open.I have to admit it does feel a bit strange to use HTTP error codes in WebSocket messages, but I personally like the re-use of the Problem Details Format.
Let me know what you think.
P.S. There was also talk in #67 of trying to align message types with the Scripting API, though I'm not sure that scripting errors and protocol errors always have a direct correlation.
Preview | Diff