Skip to content

Conversation

@TinaHeiligers
Copy link
Contributor

@TinaHeiligers TinaHeiligers commented Oct 30, 2025

At some point, depending directly on Boom for error handling snuck into the SOR APIs, which leaves the SOR and API consumers vulnerable to breaking changes from @hapi upgrades.

This PR introduces an error helper in much the same way as other errors are handled in the SOR to minimise direct imports from framework packages.

@TinaHeiligers TinaHeiligers requested a review from a team as a code owner October 30, 2025 23:57
@TinaHeiligers TinaHeiligers added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting v9.3.0 labels Oct 30, 2025
return Boolean(doc && 'found' in doc);
}

export function isForbiddenSpacesError(error: unknown): boolean {
Copy link
Contributor Author

@TinaHeiligers TinaHeiligers Oct 31, 2025

Choose a reason for hiding this comment

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

Copy link
Contributor

Choose a reason for hiding this comment

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

Errors are usually defined in src/core/packages/saved-objects/server/src/saved_objects_error_helpers.ts and then given a code like CODE_BAD_REQUEST so that we can accurately test against them.

If we only test against the status code I'm afraid that not all errors that pass isForbiddenSpacesError are actually because of a spaces forbidden error.

This might be harder because it's coming from the spacesExtension but I think we should try to move towards errors that communicate the problem in domain language instead of generic 403 status codes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes v9.3.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants