Re: [Vala] Can constructors throw errors, cascade?
- From: Luca Bruno <lethalman88 gmail com>
- To: bsquared <bwcode4u gmail com>
- Cc: vala-list <vala-list gnome org>
- Subject: Re: [Vala] Can constructors throw errors, cascade?
- Date: Wed, 7 Sep 2011 18:15:52 +0200
On Wed, Sep 7, 2011 at 6:02 PM, bsquared <bwcode4u 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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]