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

Increased maximum length of displayed error message #8658

Merged
merged 1 commit into from
Nov 7, 2024
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
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,
};
Loading