dart-archive / sdk

The Dartino project was an experiment seeking to improve productivity when writing application code for embedded devices.
https://dartino.org
Other
330 stars 36 forks source link

The exception for sending mutable objects is too generic #497

Open sgjesse opened 8 years ago

sgjesse commented 8 years ago

Sending a mutable object on a port results in a ArgumentError with no additional information.

E.g.:

$ dartino run ~/dartino-projects/test/main.dart
Using template settings file '/tmp/dartino-sdk/internal/.dartino-settings'
Uncaught exception: Instance of 'ArgumentError' {
  ArgumentError._hasValue: false
  ArgumentError.invalidValue: null
  ArgumentError.name: null
  ArgumentError.message: null
}
* 0: main        @new Port(new Channel()).send(new A(1))

/usr/local/google/home/sgjesse/dartino-projects/test/main.dart:6:3
1    import 'dart:dartino';
2    
3    import 'package:stm32/stm32f746g_disco.dart';
4    
5    main() {
6      new Port(new Channel()).send(new A(1));
7      // TODO: Add your Dartino code here.
8    }
9    
10   class A {
11     final int x;

Here is the source:

import 'dart:dartino';

import 'package:stm32/stm32f746g_disco.dart';

main() {
  new Port(new Channel()).send(new A(1));
  // TODO: Add your Dartino code here.
}

class A {
  final int x;
  A(this.x);
}

The output from pkg/dartino_compiler/bin/decode_stacktraces.dart gives even less information:

internal/dart-sdk/bin/dart internal/pkg/dartino_compiler/bin/decode_stacktraces.dart 32 float ~/dartino-projects/draw/main.snapshot.info.json 
Uncaught exception:
a Instance: 
  - class = class
  - @0 = instance of class
  - @1 = null
  - @2 = null
  - @3 = null

Frame  0: Function(29948)
Frame  1: Function(53148)
Frame  2: Function(53032)
Frame  3: Function(41056)
Frame  4: Function(41020)
Frame  5: Function(29412)
Uncaught exception:
a Instance: 
  - class = class
  - @0 = instance of class
  - @1 = null
  - @2 = null
  - @3 = null

   0: Port.send
   1: touchFiber
   2: main.<anonymous>
   3: runToEnd
   4: Fiber._forked.<anonymous>
   5: Coroutine._coroutineStart