CASMCMS-8965: Update sessions controller to provide error responses consistently and correctly #430
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.
CAST-35696 was opened because when creating a BOS session with the CLI, if a nonexistent template name is specified, the error is less than informative:
Now, this is not a case of the BOS server code not providing more details. You can see this if you run the same command with the verbose option (I've truncated the output to highlight the error details):
The root cause here is another case of BOS not following its own API spec. Per the API spec, this endpoint should be returning a
ProblemDetails
object, which the CLI then knows how to parse and decode. However, in a couple of cases, this endpoint instead just returns a plain string (along with the 400 status). This is why the CLI is not properly presenting the response.This PR modifies the sessions controller, creating a few helper functions to ensure that every endpoint returns the correct (per the API) responses, and does some minor tidying/clarifications in the API spec. This PR also removes the no-longer-used
MultitenancyNotSupported
problem details.On mug, with the updated BOS applied, you can see that the CLI now provides the error message even in non-verbose mode:
I deliberately made this PR against the development branch for CASMCMS-9265, because this uses some of the imports added with that PR, and this made it less messy.