Skip to content

Commit

Permalink
Remove unnecessary try/catch
Browse files Browse the repository at this point in the history
  • Loading branch information
gitKrystan committed Jun 6, 2023
1 parent 7d97c7f commit 3734a1b
Showing 1 changed file with 1 addition and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,7 @@ import { getInternalComponentManager as getComponentManager } from '@glimmer/man
* @returns {boolean} True if it's a component, false if not
*/
function isComponent(maybeComponent: object): maybeComponent is ComponentLike {
// SAFETY: in more recent versions of @glimmer/manager,
// this throws an error when maybeComponent does not have
// an associated manager.
try {
return !!getComponentManager(maybeComponent, true);
} catch (e) {
if (
`${e}`.includes(
`wasn't a component manager associated with the definition`
)
) {
return false;
}

throw e;
}
return !!getComponentManager(maybeComponent, true);
}

export default isComponent;

0 comments on commit 3734a1b

Please sign in to comment.