On Wed, Sep 7, 2011 at 6:02 PM, bsquared <bwcod...@gmail.com> wrote:

> Being new to both Vala and GObjects I hope you will forgive me if my
> questions are obvious.
>
> Is it acceptable for a constructor to throw an error.
> ie.
>
>                public ResourceFile.from_file (string rc_filename)  throws
> GLib.FileError {
>                        string sz_data;
>                        if (FileUtils.test (rc_filename,
> FileTest.IS_REGULAR)) {
>                                if (!FileUtils.get_contents(rc_filename, out
> sz_data)) {
>                                        throw new GLib.FileError.FAILED
> (_("could not load
> %s.\n".printf(rc_filename)));
>                                }
>                                ResourceFile.from_data(sz_data); // Is this
> OK to cascade?
>                        }
>                }
>

It's this.from_data(sz.data).

See https://live.gnome.org/Vala/Tutorial#Construction

-- 
www.debian.org - The Universal Operating System
_______________________________________________
vala-list mailing list
vala-list@gnome.org
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to