Skip to content

Commit

Permalink
Improve error message when incorrect component constructor passed to …
Browse files Browse the repository at this point in the history
…app.component
  • Loading branch information
craigbeck committed Apr 26, 2024
1 parent b84cdd7 commit 3a70f3a
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/App.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ export abstract class App extends EventEmitter {
name = null;
}
if (typeof constructor !== 'function') {
throw new Error('Missing component constructor argument');
if (typeof name === 'string') {
throw new Error(`Missing component constructor argument for ${name} with constructor of ${JSON.stringify(constructor)}`);
}
throw new Error(`Missing component constructor argument. Cannot use passed constructor of ${JSON.stringify(constructor)}`);
}

const viewProp = constructor.view;
Expand Down

0 comments on commit 3a70f3a

Please sign in to comment.