Skip to content

Commit

Permalink
better error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
riccardoperra committed Nov 8, 2023
1 parent c03ac94 commit d4f2157
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions packages/state/src/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import { onCleanup } from 'solid-js';
import { ApiDefinition } from '~/api-definition';
import { Container } from '~/container';
import { ResolvedPluginContext } from '~/resolved-plugin-context';
import { StateBuilderError } from '~/error';

export const $CREATOR = Symbol('store-creator-api'),
$PLUGIN = Symbol('store-plugin');

/**
* A factory function that creates a store API definition creator.
*
Expand Down Expand Up @@ -44,8 +44,8 @@ function checkDependencies(

dependencies.forEach((dependency) => {
if (!resolvedPlugins.includes(dependency)) {
throw new Error(
`[statebuilder] The dependency '${dependency}' of plugin '${meta.name}' is missing`,
throw new StateBuilderError(
`The dependency '${dependency}' of plugin '${meta.name}' is missing`,
{ cause: { resolvedDependencies: resolvedPlugins, plugin } },
);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/state/src/solid/provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export function StateProvider(props: FlowProps) {
export function getStateContext() {
const container = useContext(StateProviderContext);
if (!container) {
throw new Error('No <StateProvider> found in component tree');
throw new StateBuilderError('No <StateProvider> found in component tree');
}
return container;
}
Expand Down

0 comments on commit d4f2157

Please sign in to comment.