diff options
author | Fabio Berger <me@fabioberger.com> | 2018-07-10 01:53:54 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-07-10 01:53:54 +0800 |
commit | 82771ec64a6fc0d2d260ec4bd44391f451585131 (patch) | |
tree | 42350f80583bbbc6951a4134b5c46a8e28b54276 /packages/react-docs/src/components/documentation.tsx | |
parent | ada8a402da2f458029cb1788f152fe04a5c4c957 (diff) | |
download | dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.tar dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.tar.gz dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.tar.bz2 dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.tar.lz dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.tar.xz dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.tar.zst dexon-sol-tools-82771ec64a6fc0d2d260ec4bd44391f451585131.zip |
Remove comment and add assertion
Diffstat (limited to 'packages/react-docs/src/components/documentation.tsx')
-rw-r--r-- | packages/react-docs/src/components/documentation.tsx | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/packages/react-docs/src/components/documentation.tsx b/packages/react-docs/src/components/documentation.tsx index 7030001e8..ff33220d2 100644 --- a/packages/react-docs/src/components/documentation.tsx +++ b/packages/react-docs/src/components/documentation.tsx @@ -182,10 +182,16 @@ export class Documentation extends React.Component<DocumentationProps, Documenta } private _renderSection(typeDefinitionByName: TypeDefinitionByName, sectionName: string): React.ReactNode { const markdownVersions = _.keys(this.props.docsInfo.sectionNameToMarkdownByVersion); - // Get version LTE to selectedVersion const eligibleVersions = _.filter(markdownVersions, mdVersion => { return semver.lte(mdVersion, this.props.selectedVersion); }); + if (_.isEmpty(eligibleVersions)) { + throw new Error( + `No eligible markdown sections found for ${this.props.docsInfo.displayName} version ${ + this.props.selectedVersion + }.`, + ); + } const sortedEligibleVersions = eligibleVersions.sort(semver.rcompare.bind(semver)); const closestVersion = sortedEligibleVersions[0]; const markdownFileIfExists = this.props.docsInfo.sectionNameToMarkdownByVersion[closestVersion][sectionName]; |