Skip to content

Instantly share code, notes, and snippets.

@axross
Created December 17, 2016 19:16
Show Gist options
  • Select an option

  • Save axross/9b7fdc1a49d4f28c96804ef90f7b0207 to your computer and use it in GitHub Desktop.

Select an option

Save axross/9b7fdc1a49d4f28c96804ef90f7b0207 to your computer and use it in GitHub Desktop.
class HelloException implements Exception {
String cause;
HelloException(this.cause);
}
main() {
var a = 1;
try {
if (a != 2) {
throw new HelloException('OMG');
}
} on HelloException {
print('hello exception');
} on Exception catch (e) {
print('no, no');
}
}
export const lib__example = Object.create(null);
import { core, dart, dartx } from 'dart_sdk';
let VoidTodynamic = () => (VoidTodynamic = dart.constFn(dart.definiteFunctionType(dart.dynamic, [])))();
lib__example.HelloException = class HelloException extends core.Object {
new(cause) {
this.cause = cause;
}
};
lib__example.HelloException[dart.implements] = () => [core.Exception];
dart.setSignature(lib__example.HelloException, {
constructors: () => ({new: dart.definiteFunctionType(lib__example.HelloException, [core.String])}),
fields: () => ({cause: core.String})
});
lib__example.main = function() {
let a = 1;
try {
if (a != 2) {
dart.throw(new lib__example.HelloException('OMG'));
}
} catch (e$) {
if (lib__example.HelloException.is(e$)) {
core.print('hello exception');
} else if (core.Exception.is(e$)) {
let e = e$;
core.print('no, no');
} else
throw e$;
}
};
dart.fn(lib__example.main, VoidTodynamic());
//# sourceMappingURL=example.js.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment