Skip to content

Commit

Permalink
Crash and burn if core services are not available
Browse files Browse the repository at this point in the history
  • Loading branch information
afgomez authored and Alejandro Fernández Gómez committed Sep 2, 2020
1 parent 6a29684 commit 1ed3dda
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion x-pack/plugins/infra/public/components/log_stream/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,23 @@ export const LogStream: React.FC<LogStreamProps> = ({
}) => {
// source boilerplate
const { services } = useKibana();
if (!services?.http?.fetch) {
throw new Error(
`<LogStream /> cannot access kibana core services.
Ensure the component is mounted within kibana-react's <KibanaContextProvider> hierarchy.
Read more at https://github.com/elastic/kibana/blob/master/src/plugins/kibana_react/README.md"
`
);
}

const {
sourceConfiguration,
loadSourceConfiguration,
isLoadingSourceConfiguration,
} = useLogSource({
sourceId,
fetch: services?.http?.fetch!,
fetch: services.http.fetch,
});

// Internal state
Expand Down

0 comments on commit 1ed3dda

Please sign in to comment.