Skip to content

Commit

Permalink
Increased maximum length of displayed error message (#8658)
Browse files Browse the repository at this point in the history
  • Loading branch information
bsekachev authored Nov 7, 2024
1 parent 53a84c8 commit 58775bf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cvat-ui/src/components/cvat-app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -398,18 +398,21 @@ class CVATApplication extends React.PureComponent<CVATAppProps & RouteComponentP
function showError(title: string, _error: Error, shouldLog?: boolean, className?: string): void {
const error = _error?.message || _error.toString();
const dynamicProps = typeof className === 'undefined' ? {} : { className };

let errorLength = error.length;
// Do not count the length of the link in the Markdown error message
if (/]\(.+\)/.test(error)) {
errorLength = error.replace(/]\(.+\)/, ']').length;
}

notification.error({
...dynamicProps,
message: (
<CVATMarkdown history={history}>{title}</CVATMarkdown>
),
duration: null,
description: errorLength > 300 ? 'Open the Browser Console to get details' : <CVATMarkdown history={history}>{error}</CVATMarkdown>,
description: errorLength > appConfig.MAXIMUM_NOTIFICATION_MESSAGE_LENGTH ?
'Open the Browser Console to get details' : <CVATMarkdown history={history}>{error}</CVATMarkdown>,
});

if (shouldLog) {
Expand Down
2 changes: 2 additions & 0 deletions cvat-ui/src/config.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ const DEFAULT_GOOGLE_CLOUD_STORAGE_LOCATIONS: string[][] = [
['NAM4', 'US-CENTRAL1 and US-EAST1'],
];

const MAXIMUM_NOTIFICATION_MESSAGE_LENGTH = 600; // all above will be sent to console
const HEALTH_CHECK_RETRIES = 10;
const HEALTH_CHECK_PERIOD = 3000; // ms
const HEALTH_CHECK_REQUEST_TIMEOUT = 15000; // ms
Expand Down Expand Up @@ -190,4 +191,5 @@ export default {
REQUEST_SUCCESS_NOTIFICATION_DURATION,
BLACKLISTED_GO_BACK_PATHS,
PAID_PLACEHOLDER_CONFIG,
MAXIMUM_NOTIFICATION_MESSAGE_LENGTH,
};

0 comments on commit 58775bf

Please sign in to comment.