diff --git a/webapp/channels/src/components/admin_console/__snapshots__/elasticsearch_settings.test.tsx.snap b/webapp/channels/src/components/admin_console/__snapshots__/elasticsearch_settings.test.tsx.snap index ad4d87f9e50..be55e8bc38f 100644 --- a/webapp/channels/src/components/admin_console/__snapshots__/elasticsearch_settings.test.tsx.snap +++ b/webapp/channels/src/components/admin_console/__snapshots__/elasticsearch_settings.test.tsx.snap @@ -277,7 +277,7 @@ exports[`components/ElasticSearchSettings should match snapshot, disabled 1`] = /> } id="testConfig" - includeDetailedError={false} + includeDetailedError={true} requestAction={[Function]} saveNeeded={false} showSuccessMessage={true} @@ -771,7 +771,7 @@ exports[`components/ElasticSearchSettings should match snapshot, enabled 1`] = ` /> } id="testConfig" - includeDetailedError={false} + includeDetailedError={true} requestAction={[Function]} saveNeeded={false} showSuccessMessage={true} diff --git a/webapp/channels/src/components/admin_console/elasticsearch_settings.tsx b/webapp/channels/src/components/admin_console/elasticsearch_settings.tsx index 20b81623cfb..106f189d609 100644 --- a/webapp/channels/src/components/admin_console/elasticsearch_settings.tsx +++ b/webapp/channels/src/components/admin_console/elasticsearch_settings.tsx @@ -180,7 +180,7 @@ export default class ElasticsearchSettings extends OLDAdminSettings void, error: (error: {message: string; detailed_message?: string}) => void): void => { + doTestConfig = (success: () => void, error: (error: {message: string; detailed_error?: string}) => void): void => { const config = JSON.parse(JSON.stringify(this.props.config)); this.getConfigFromState(config); @@ -193,7 +193,7 @@ export default class ElasticsearchSettings extends OLDAdminSettings { + (err: {message: string; detailed_error?: string}) => { this.setState({ configTested: false, canSave: false, @@ -412,6 +412,7 @@ export default class ElasticsearchSettings extends OLDAdminSettings} buttonText={} successMessage={defineMessage({ diff --git a/webapp/channels/src/components/admin_console/schema_admin_settings.tsx b/webapp/channels/src/components/admin_console/schema_admin_settings.tsx index 7237b23e7f3..748235e2371 100644 --- a/webapp/channels/src/components/admin_console/schema_admin_settings.tsx +++ b/webapp/channels/src/components/admin_console/schema_admin_settings.tsx @@ -380,7 +380,7 @@ export class SchemaAdminSettings extends React.PureComponent); } - const handleRequestAction = (success: () => void, error: (error: {message: string}) => void) => { + const handleRequestAction = (success: () => void, error: (error: {message: string; detailed_error?: string}) => void) => { if (!setting.skipSaveNeeded && this.state.saveNeeded !== false) { error({ message: this.props.intl.formatMessage({id: 'admin_settings.save_unsaved_changes', defaultMessage: 'Please save unsaved changes first'}), diff --git a/webapp/platform/client/src/client4.ts b/webapp/platform/client/src/client4.ts index 32ce63d196d..90c7d87152a 100644 --- a/webapp/platform/client/src/client4.ts +++ b/webapp/platform/client/src/client4.ts @@ -4500,6 +4500,7 @@ export default class Client4 { message: msg, server_error_id: data.id, status_code: data.status_code, + detailed_error: data.detailed_error, url, }); }; @@ -4896,6 +4897,7 @@ export class ClientError extends Error implements ServerError { url?: string; server_error_id?: string; status_code?: number; + detailed_error?: string; constructor(baseUrl: string, data: ServerError, cause?: any) { super(data.message + ': ' + cleanUrlForLogging(baseUrl, data.url || ''), {cause}); @@ -4904,6 +4906,7 @@ export class ClientError extends Error implements ServerError { this.url = data.url; this.server_error_id = data.server_error_id; this.status_code = data.status_code; + this.detailed_error = data.detailed_error; // Ensure message is treated as a property of this class when object spreading. Without this, // copying the object by using `{...error}` would not include the message. diff --git a/webapp/platform/types/src/errors.ts b/webapp/platform/types/src/errors.ts index 822de727362..d2a5e6285b1 100644 --- a/webapp/platform/types/src/errors.ts +++ b/webapp/platform/types/src/errors.ts @@ -6,6 +6,7 @@ export type ServerError = { server_error_id?: string; stack?: string; message: string; + detailed_error?: string; status_code?: number; url?: string; };