-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: change error handling * marginy review fixes
- Loading branch information
Showing
9 changed files
with
95 additions
and
89 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,13 @@ | ||
import React from 'react'; | ||
import block from 'bem-cn-lite'; | ||
import {i18n} from '../../i18n'; | ||
import type {ChartKitError} from '../../libs'; | ||
|
||
import './ErrorView.scss'; | ||
type Props = { | ||
error: ChartKitError | Error; | ||
}; | ||
|
||
const b = block('chartkit-error'); | ||
export const ErrorView = ({error}: Props) => { | ||
const message = error.message || i18n('error', 'label_unknown-error'); | ||
|
||
export const ErrorView = () => { | ||
return ( | ||
<div className={b()}> | ||
<div className={b('title')}>{i18n('common', 'error')}</div> | ||
<div className={b('message')}>{i18n('common', 'error-unknown-extension')}</div> | ||
</div> | ||
); | ||
return <div>{message}</div>; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"common": { | ||
"error": "Error", | ||
"error-unknown-extension": "Unknown chart type", | ||
"tooltip-sum": "Sum", | ||
"tooltip-rest": "Rest" | ||
}, | ||
"error": { | ||
"label_unknown-plugin": "Unknown plugin type \"{{type}}\"", | ||
"label_unknown-error": "Unknown error" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,10 @@ | ||
{ | ||
"common": { | ||
"error": "Ошибка", | ||
"error-unknown-extension": "Неизвестный тип чарта", | ||
"tooltip-sum": "Сумма", | ||
"tooltip-rest": "Остальные" | ||
}, | ||
"error": { | ||
"label_unknown-plugin": "Неизвестный тип плагина \"{{type}}\"", | ||
"label_unknown-error": "Неизвестная ошибка" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
export {getRandomCKId} from './common'; | ||
export {typedMemo} from './react'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import React from 'react'; | ||
|
||
// For some reason React.memo drops the generic prop type and creates a regular union type | ||
// https://github.com/DefinitelyTyped/DefinitelyTyped/issues/37087#issuecomment-542793243 | ||
export const typedMemo: <T>(component: T) => T = React.memo; |