Exceptions only show type name and not actual useful exception information
See original GitHub issueRepro steps:
- Enable Dart 2 preview modfe
- Create new Flutter ap
- Replace main.dart with the contents belowe
- 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:
- Created 6 years ago
- Comments:10 (10 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’ll open another issue about inserted into locals, but the exception info now shows the string:
Looks great!