summaryrefslogtreecommitdiff
path: root/tests/errors
diff options
context:
space:
mode:
authorRico Tzschichholz <ricotz@ubuntu.com>2018-07-05 08:17:32 +0200
committerRico Tzschichholz <ricotz@ubuntu.com>2018-07-05 12:42:00 +0200
commit03d4222d92195700bb58bbb1ca26c9234017ffbe (patch)
tree6b74bfbe69f35c2b73e4174b2087c6e97cbe8554 /tests/errors
parent204c7bae660aa96a1ebf69e33f21128575511394 (diff)
downloadvala-03d4222d92195700bb58bbb1ca26c9234017ffbe.tar.gz
codegen: Let methods return -1 on error by default if possible
Fixes https://gitlab.gnome.org/GNOME/vala/issues/526
Diffstat (limited to 'tests/errors')
-rw-r--r--tests/errors/bug762377.vala18
1 files changed, 18 insertions, 0 deletions
diff --git a/tests/errors/bug762377.vala b/tests/errors/bug762377.vala
new file mode 100644
index 000000000..f5b2fb959
--- /dev/null
+++ b/tests/errors/bug762377.vala
@@ -0,0 +1,18 @@
+class FooOutputStream : GLib.OutputStream {
+ public override ssize_t write (uint8[] buffer, Cancellable? cancellable = null) throws IOError {
+ throw new IOError.FAILED ("");
+ }
+
+ public override bool close (Cancellable? cancellable = null) throws IOError {
+ return true;
+ }
+}
+
+void main () {
+ try {
+ var output = new FooOutputStream ();
+ size_t bytes_written;
+ output.write_all ("Hello world!".data, out bytes_written);
+ } catch (IOError e) {
+ }
+}