Skip to content

Commit

Permalink
Separate error for UI-exposed messages
Browse files Browse the repository at this point in the history
  • Loading branch information
pickypg authored Dec 4, 2024
1 parent d753d1d commit 41f2a2b
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions x-pack/plugins/data_usage/server/services/autoops_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { AutoOpsConfig } from '../types';
import { AutoOpsError } from './errors';
import { appContextService } from './app_context';

const AUTO_OPS_FAILED_ERROR = 'AutoOps API request failed';
const AUTO_OPS_REQUEST_PREFIX = '[AutoOps API] Request failed';
const AUTO_OPS_MISSING_CONFIG_ERROR = 'Missing autoops configuration';

Expand Down Expand Up @@ -144,7 +145,7 @@ export class AutoOpsAPIService {
},
}
);
throw new AutoOpsError(withRequestIdMessage(AUTO_OPS_REQUEST_PREFIX));
throw new AutoOpsError(withRequestIdMessage(AUTO_OPS_FAILED_ERROR));
} else if (error.request) {
// The request was made but no response was received
this.logger.error(
Expand All @@ -159,7 +160,7 @@ export class AutoOpsAPIService {
errorMetadataWithRequestConfig
);
throw new AutoOpsError(
withRequestIdMessage(`${AUTO_OPS_REQUEST_PREFIX}, ${error.message}`)
withRequestIdMessage(`${AUTO_OPS_FAILED_ERROR}, ${error.message}`)
);
}
}
Expand Down

0 comments on commit 41f2a2b

Please sign in to comment.