question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

un-useful error message compiling template

See original GitHub issue

Upgrading an old application to Ember 3.26.

<span {{action 'doSomething'}}>
</span>

Expected Compiles successfully or logs useful error message

Actual

Template Compiler Error (TemplateCompiler) in my-project/application/template.hbs

Cannot read property 'start' of undefined

The problem seems to be the action. Removing it fixes the error.

Obviously we shouldn’t be doing this any more, and using a button with the on modifier instead. But the compiler error message does not help the developer find the problem and fix it.

Fix 1: Show location of error in .hbs file (line, column) Fix 2: Help the developer know what they’ve done wrong. Old tutorials will have developers writing code like this.

EDIT: Now happening with <div><button type="button"/></div>

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:9 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
jdurandcommented, Jul 1, 2021

Just a little update in case someone else faces the same deprecation scenario. I was using ember-gestures for swipe actions. I was able to get rid of the ember-gestures dependency very easily with an ember-modifier:

// app/modifiers/on-swipe-right.js

import { modifier } from "ember-modifier";
import * as Hammer from 'hammerjs';

export default modifier((element, [fn]) => {
  const containerManager = new Hammer.Manager(element);
  const swipe = new Hammer.Swipe({
    direction: Hammer.DIRECTION_RIGHT,
    threshold: 10,
  });

  containerManager.add(swipe);
  containerManager.on('swiperight', fn, { passive: true });

  return () => {
    containerManager.destroy();
  }
});
<div
-  {{recognize-gesture "swipe"}}
-  {{on 'swiperight' (fn this.swipeRight @item)}}
+  {{on-swipe-right (fn this.swipeRight @item)}}
 >
  {{yield}}
</div>
0reactions
jdurandcommented, Jun 13, 2021
Read more comments on GitHub >

github_iconTop Results From Across the Web

C++ compiler doesn't give useful error messages
When using expression templates (e.g. Boost) and an error is detected, the original source line MUST be supplied; otherwise, the user has no...
Read more >
Why are template errors so horrendously verbose? : r/cpp
A lot of the time, template errors are extremely verbose, but depending on the actual problem different parts of those errors can be...
Read more >
Tools to generate higher-quality error messages for template ...
I'm working since a long time with templates and error messages have ... While it is good that compiler writers work on improving...
Read more >
Why are C++ template error messages so horrific?
Template error messages may be notorious, but are by no means always long and unreadable. In this case, the entire error message (from...
Read more >
Writing Good Compiler Error Messages | Code → Software
Write messages in first person plural. That is, use “we”. For example “we see an error”. This personifies the compiler as a team...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found