Re: [Vala] Can I use the symbolic name of the code of errors in code



On Wed, Apr 30, 2008 at 10:31 AM, Jürg Billeter <j bitron ch> wrote:
On Tue, 2008-04-29 at 18:08 +0200, Jaap A. Haitsma wrote:
 > Say I have the program at the bottom of this mail and in the catch
 > clause I want to know the error that was thrown was from the FAILED or
 > the SYNTAX code. How can I check this. I can obtain the error code by
 > e.code but how do I compare it with FAILED or SYNTAX
 >
 > I'd like to write something like:
 >
 > if (e.code == MyError.FAILED) {
 >
 > }

 I was planning to add support for

    if (e is MyError.FAILED)

 and also

    catch (MyError.FAILED e)

 i.e. treat error codes as subtypes of error domains.

 Any comments or objections?

Go for it!!


Jaap



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]