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.

Exceptions only show type name and not actual useful exception information

See original GitHub issue

Repro steps:

  1. Enable Dart 2 preview modfe
  2. Create new Flutter ap
  3. Replace main.dart with the contents belowe
  4. Run

=> program breaks on a _TypeError, and the debug console says: breaking at exception: _TypeError

Can we have an easier to understand error message?

Also, we should provide more information on what failed. If you try the same in IntelliJ or from the terminal, you get:

type 'String' is not a subtype of type 'int' of 'function result' where
  String is from dart:core
  int is from dart:core

main.dart:

import 'package:flutter/material.dart';
import 'dart:convert';

int lowestPrice() {
  List<int> prices = JSON.decode('["7", "100", "500"]');
  prices.sort();
  return prices[0];
}

void main() => runApp(new MyApp(lowestPrice()));

class MyApp extends StatelessWidget {
  final int lp;
  MyApp(this.lp);

  @override
  Widget build(BuildContext context) {
    return new MaterialApp(
      home: new Scaffold(
        appBar: new AppBar(),
        body: new Text('Lowest price $lp'),
      ),
    );
  }
}

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
DanTupcommented, Mar 1, 2018

I’ll open another issue about inserted into locals, but the exception info now shows the string:

Debugger

0reactions
devoncarewcommented, Mar 1, 2018

Looks great!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Types of Exceptions in Java - Stackify
Learn about the different types of exceptions in Java (checked and unchecked) and see specific examples.
Read more >
Types of Exception in Java with Examples - GeeksforGeeks
Built-in exceptions are the exceptions that are available in Java libraries. These exceptions are suitable to explain certain error ...
Read more >
How to get the name of an exception that was caught in Python?
I have a couple scenarios where I want to catch all exceptions (or a list of them), and want to print out the...
Read more >
Best Practices for exceptions - .NET - Microsoft Learn
Learn best practices for exceptions, such as using try/catch/finally, handling common conditions without exceptions, and using predefined .
Read more >
Most Common Java Exceptions | Rollbar
If no handler exists in the Service class, then the exception will flow through the stack trace to the Controller class. If the...
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