import { useEntity } from "@backstage/plugin-catalog-react" ; export const BUGSNAG_ANNOTATION = 'bugsnag.com/project-key' ; export const useBugsnagData = ( ) => { const { entity } = useEntity ( ) ; const bugsnagSlug = entity ?. metadata . annotations ?. [ BUGSNAG_ANNOTATION ] ?? '' ; if ( ! bugsnagSlug ) { throw new Error ( "'bugsnag.com/project-key' annotation is missing" ) ; } const slugElements = bugsnagSlug . split ( '/' ) . map ( p => p . trim ( ) ) ; if ( slugElements . length < 2 ) { throw new Error ( "'bugsnag.com/project-key' annotation is missing" ) ; } return slugElements ; } ;