Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.11] [Data View Field Editor] Fix getErrorCodeFromErrorReason check to work in both stateful and Serverless (#168125) #168243

Merged
merged 1 commit into from
Oct 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { ScriptError } from '../components/preview/types';
import { RuntimeFieldPainlessError, PainlessErrorCode } from '../types';

export const getErrorCodeFromErrorReason = (reason: string = ''): PainlessErrorCode => {
if (reason.startsWith('Cannot cast from')) {
if (reason.includes('Cannot cast from')) {
return 'CAST_ERROR';
}
return 'UNKNOWN';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,7 @@ export default function ({ getService }: FtrProviderContext) {
});
};

// Failing: See https://github.com/elastic/kibana/issues/165868
describe.skip('Field preview', function () {
describe('Field preview', function () {
before(async () => await createIndex());
after(async () => await deleteIndex());

Expand Down Expand Up @@ -149,10 +148,7 @@ export default function ({ getService }: FtrProviderContext) {
// As ES does not return error codes we will add a test to make sure its error message string
// does not change overtime as we rely on it to extract our own error code.
// If this test fail we'll need to update the "getErrorCodeFromErrorReason()" handler
// TODO: `response.error?.caused_by?.reason` returns
// `class_cast_exception: Cannot cast from [int] to [java.lang.String].`
// in Serverless, which causes `getErrorCodeFromErrorReason` to fail
it.skip('should detect a script casting error', async () => {
it('should detect a script casting error', async () => {
const { body: response } = await supertest
.post(FIELD_PREVIEW_PATH)
.set(ELASTIC_HTTP_VERSION_HEADER, INITIAL_REST_VERSION)
Expand Down
Loading