[Vala] Error codes as values?
- From: "Sam Danielson" <samdanielson gmail com>
- To: vala-list <vala-list gnome org>
- Subject: [Vala] Error codes as values?
- Date: Tue, 6 Jan 2009 15:41:10 -0500
Given that many C libraries return integer error codes, is there a way
to pass the return value into a "throw new". How would I set up the
errordomain in the vapi file so the enumeration codes match?
Prefer this (doesn't actually work):
code = Database.open(filename, out _db);
if ( code != OK ) throw new WrapperError ( code, "Could not open database" );
intstead of this:
switch ( code ) {
case A: throw new WrapperError.A ( "foo" ); break;
case B: throw new WrapperError.B ( "bar" ); break;
}
-Sam
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]