hotwired / hotwired/stimulus

Handle error when controller not found

Open
#712 3 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
TypeScript
Stars
13.1k
Forks
441
PR merge metrics
No merged PRs in 30d

Description

Lets assume I am referencing a controller at data-controller="does-not-exist", which does not exist.
This can happen due to a typo - or because the controller has not been loaded for some reason (e.g. not in the load path, caching issue etc.)

When I see it correctly, this would never get raised. Not as an exception. Not even when the debug mode is enabled.

What is the rigtht approach to get this noticable? I would prefer if I can see it in my console when debug mode is enabled and when this will be handled by Application#handleError.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing how a missing data-controller="does-not-exist" reference is handled and how Application#handleError is invoked. Check the debug-mode path as well as normal error handling. Done means a missing controller becomes noticeable in the console when debug mode is enabled and is passed to Application#handleError.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
frontend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.