Skip to content
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
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/ebt": "^1.2.1",
"@elastic/ecs": "^8.11.5",
"@elastic/elasticsearch": "9.0.2",
"@elastic/elasticsearch": "9.0.3",
"@elastic/ems-client": "8.6.3",
"@elastic/eui": "104.0.2",
"@elastic/eui-amsterdam": "npm:@elastic/eui@104.0.0-amsterdam.0",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function getBulkOperationError(
id: string,
rawResponse: {
status: number;
error?: { type: string; reason?: string; index: string };
error?: { type: string; reason?: string | null; index: string };
// Other fields are present on a bulk operation result but they are irrelevant for this function
}
): Payload | undefined {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@ export const isClusterShardLimitExceeded = (errorCause?: ErrorCause): boolean =>
);
};

export const hasAllKeywordsInOrder = (message: string | undefined, keywords: string[]): boolean => {
export const hasAllKeywordsInOrder = (
message: string | null | undefined,
keywords: string[]
): boolean => {
if (!message || !keywords.length) {
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {

/** @internal */
export interface WaitForTaskResponse {
error: Option.Option<{ type: string; reason?: string; index?: string }>;
error: Option.Option<{ type: string; reason?: string | null; index?: string }>;
completed: boolean;
failures: Option.Option<any[]>;
description?: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -203,10 +203,10 @@ export interface InvalidateAPIKeyResult {
*/
error_details?: Array<{
type?: string;
reason?: string;
reason?: string | null;
caused_by?: {
type?: string;
reason?: string;
reason?: string | null;
};
}>;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ export const extractErrorProperties = (error: ErrorType): MLErrorObject => {
) {
errObj.causedBy =
error.body.attributes.body.error.caused_by?.caused_by?.reason ||
error.body.attributes.body.error.caused_by?.reason;
error.body.attributes.body.error.caused_by?.reason ||
undefined; // Remove 'null' option from the types
}
if (
Array.isArray(error.body.attributes.body.error.root_cause) &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ export const deleteAlertsForQuery = async (
action: AlertAuditAction.DELETE,
id: alertUuid,
outcome: 'failure',
error: new Error(item.delete?.error?.reason),
error: new Error(item.delete?.error?.reason ?? undefined), // reason can be null and it's not a valid parameter for Error
})
);
errors.push(`Error deleting alert "${alertUuid!}" - ${item.delete?.error?.reason}`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ export async function updateTagsBatch(
agentId: failure.id,
actionId,
namespace: spaceId,
error: failure.cause.reason,
error: failure.cause.reason ?? undefined, // reason can be null and we want to replace it with undefined
}))
);
appContextService.getLogger().debug(`action failed result wrote on ${failureCount} agents`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ export const bulkDeleteArtifacts = async (
if (res.errors) {
errors = res.items.reduce<Error[]>((acc, item) => {
if (item.delete?.error) {
acc.push(new Error(item.delete.error.reason));
acc.push(new Error(item.delete.error.reason ?? undefined)); // reason can be null and it's not a valid parameter for Error
}
return acc;
}, []);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -393,7 +393,7 @@ export abstract class InferenceBase<TInferResponse> {
if (doc === undefined) {
if (error) {
this.setFinishedWithErrors(error as unknown as MLHttpFetchError);
throw Error(error.reason);
throw Error(error.reason ?? undefined); // reason can be null and it's not a valid parameter for Error
}

throw Error(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ export class TaskStore {

if (item.update?.error) {
const err = new BulkUpdateError({
message: item.update.error.reason,
message: item.update.error.reason ?? undefined, // reason can be null, and we want to keep `message` as string | undefined
type: item.update.error.type,
statusCode: item.update.status,
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ describe('logClusterShardFailuresEsql', () => {
it('should add warning message when shard failures exist in a single cluster', () => {
const shardFailure: EsqlEsqlShardFailure = {
reason: { type: 'test_failure', reason: 'test failure' },
shard: '0',
shard: 0,
index: 'test-index',
};

Expand Down Expand Up @@ -70,13 +70,13 @@ describe('logClusterShardFailuresEsql', () => {
it('should add warning message when shard failures exist in multiple clusters', () => {
const shardFailure1: EsqlEsqlShardFailure = {
reason: { type: 'test_failure_1', reason: 'test failure 1' },
shard: '0',
shard: 0,
index: 'test-index-1',
};

const shardFailure2: EsqlEsqlShardFailure = {
reason: { type: 'test_failure_2', reason: 'test failure 2' },
shard: '1',
shard: 1,
index: 'test-index-2',
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,12 @@ export type ShardError = Partial<{
node: string;
reason: Partial<{
type: string;
reason: string;
reason: string | null;
index_uuid: string;
index: string;
caused_by: Partial<{
type: string;
reason: string;
reason: string | null;
}>;
}>;
}>;
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -2139,10 +2139,10 @@
"@elastic/transport" "^8.3.1"
tslib "^2.4.0"

"@elastic/elasticsearch@9.0.2":
version "9.0.2"
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-9.0.2.tgz#66fb8465fdeabb0c1174d3c48c0a2d5ad5d177c4"
integrity sha512-uKA0PuPSND3OhHH9UFqnKZfxifAg/8mQW4VnrQ+sUtusTbPhGuErs5NeWCPyd/RLgruBWBmLSv1zzEv5GS+UnA==
"@elastic/elasticsearch@9.0.3":
version "9.0.3"
resolved "https://registry.yarnpkg.com/@elastic/elasticsearch/-/elasticsearch-9.0.3.tgz#96302c6dfae27503d5271aba318883fdef4051bd"
integrity sha512-aagnssrVQi538wExO0Au169amtq68sXSwQMyzblQVAsqcmbqRTtzmGhKOjnDP0LK3ml0Mtje1uX+Vda7RhqDsA==
dependencies:
"@elastic/transport" "^9.0.1"
apache-arrow "18.x - 19.x"
Expand Down
Loading