-
Notifications
You must be signed in to change notification settings - Fork 0
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
OV-7: error handling #21
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
helpers should not contain .tsx files. And also create a folder for file
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted the helper based on the recommendations provided during the daily meeting.
toast({ | ||
id: toastId, | ||
title: 'An error occurred.', | ||
description: stringToReactNode(message), | ||
status: 'error', | ||
duration: 7000, | ||
isClosable: true, | ||
position: 'top-right', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Create a separate service for Toast that we could call for multiple scenarios: error, warn, success, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
} | ||
} | ||
|
||
if (message !== '' && !toastService.isActive(toastId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (message !== '' && !toastService.isActive(toastId)) { | |
if (message && !toastService.isActive(toastId)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
this.toast({ | ||
id: toastId, | ||
title: title, | ||
description: message, | ||
status: 'warning', | ||
duration: 7000, | ||
isClosable: true, | ||
position: 'top-right', | ||
variant: 'solid', | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are using the same properties for every method except for status.
Create a separate function for calling toast and just pass status as argument
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename it to notification.service.ts
toast: ReturnType<typeof createStandaloneToast>['toast']; | ||
}; | ||
|
||
class ToastService { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
export { ToastService } from './toast.service.js'; | ||
export { toastService }; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to combine these 2 exports?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if I try to do so, I receive the next error:
Use export…from
to re-export NotificationService
.eslint unicorn/prefer-export-from
FEAT: Error handling #7
Test error:
Results:
Only message:
Message and details: