Skip to content

feat: KMS20-4808. Session Manager/UI: on error redirect to "oops" page#300

Open
alexey-medvedev-sap wants to merge 24 commits into
mainfrom
feature/oops-page
Open

feat: KMS20-4808. Session Manager/UI: on error redirect to "oops" page#300
alexey-medvedev-sap wants to merge 24 commits into
mainfrom
feature/oops-page

Conversation

@alexey-medvedev-sap
Copy link
Copy Markdown
Contributor

When the error occures in session manager, instead of showing just the mysterious json and returning 400, redirect to the (existing or specially designed) error page showing error and description.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 27, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 85785678-dd3c-4835-a0cf-b16dd9c49b49

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@alexey-medvedev-sap alexey-medvedev-sap requested a review from cb80 May 27, 2026 15:30
Comment thread api/session-manager.yaml Outdated
Comment thread internal/business/server/openapi.go Outdated
Comment thread internal/business/server/openapi.go Outdated
@cb80 cb80 requested a review from alienvspredator June 1, 2026 09:20
@alexey-medvedev-sap alexey-medvedev-sap marked this pull request as ready for review June 1, 2026 15:17
@alexey-medvedev-sap alexey-medvedev-sap requested a review from cb80 June 1, 2026 15:21
alexey-medvedev-sap and others added 6 commits June 1, 2026 17:43
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Co-authored-by: Chris Burkert <burkert.chris@gmail.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
cb80
cb80 previously approved these changes Jun 1, 2026
Copy link
Copy Markdown
Contributor

@cb80 cb80 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

Comment on lines +425 to +428
var serviceErr *serviceerr.Error
if !errors.As(err, &serviceErr) {
serviceErr = serviceerr.ErrUnknown
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be really good to log the original error so that it doesn't get lost.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread internal/serviceerr/errors.go Outdated
Comment on lines +101 to +113
// ErrorCode represents a user-facing error code for UI error page redirect.
type ErrorCode string

const (
ErrorCodeNoTrustConfigured ErrorCode = "NO_TRUST_CONFIGURED"
ErrorCodeTokenExchangeFailed ErrorCode = "TOKEN_EXCHANGE_FAILED"
ErrorCodeStateExpired ErrorCode = "STATE_EXPIRED"
ErrorCodeFingerprintMismatch ErrorCode = "FINGERPRINT_MISMATCH"
ErrorCodeInvalidRequest ErrorCode = "INVALID_REQUEST"
ErrorCodeServerError ErrorCode = "SERVER_ERROR"
ErrorCodeUnauthorized ErrorCode = "UNAUTHORIZED"
ErrorCodeInvalidProvider ErrorCode = "INVALID_OIDC_PROVIDER"
)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have error codes defined. We should use those.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

Comment thread internal/serviceerr/errors.go Outdated
Comment on lines +115 to +135
// ToErrorCode maps a service error to a user-facing error code for UI redirect.
func (e *Error) ToErrorCode() ErrorCode {
switch e.Err {
case CodeNotFound:
return ErrorCodeNoTrustConfigured
case CodeInvalidGrant:
return ErrorCodeTokenExchangeFailed
case CodeStateExpired:
return ErrorCodeStateExpired
case CodeFingerprintMismatch:
return ErrorCodeFingerprintMismatch
case CodeInvalidRequest, CodeInvalidLoginCSRFToken:
return ErrorCodeInvalidRequest
case CodeUnauthorizedClient:
return ErrorCodeUnauthorized
case CodeInvalidOIDCProvider:
return ErrorCodeInvalidProvider
default:
return ErrorCodeServerError
}
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't proven that CodeNotFound truly represents NoTrustConfigured error. There are no such details in CodeNotFound, and we can't assume it and upgrade the error code on this level of the definitions.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed — removed the ToErrorCode() mapping entirely. We now pass the existing error code (not_found, state_expired, etc.) directly as the errorCode query parameter without any interpretation. ok so?

Comment on lines +438 to +440
q := u.Query()
q.Set("errorCode", string(errorCode))
u.RawQuery = q.Encode()
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should include both errorCode and description.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

added

Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
…n-manager into feature/oops-page

Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
alexey-medvedev-sap and others added 7 commits June 5, 2026 12:38
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Co-authored-by: Chris Burkert <burkert.chris@gmail.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
Signed-off-by: alexey-medvedev-sap <alexey.medvedev02@sap.com>
When an error occurs during the auth flow, the session manager redirects
to the UI error page (error_uri) with errorCode and errorDescription
query parameters instead of returning a JSON error body.

The error_uri parameter is optional for backward compatibility.

Signed-off-by: Alexey Medvedev <alexey.medvedev02@sap.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants