The compiler complains about this code:

public OdbcVersion odbc_version { set { set_odbc_version_ (value); } }

private void set_odbc_version_ (OdbcVersion value) throws UnixOdbcError {
    if (!succeeded (set_environment_attribute_real (handle, Attribute.ODBC_VERSION, (void *) value, 0))) {
        throw new UnixOdbcError.SET_ENVIRONMENT_ATTRIBUTE ("Could not set environment attribute");
    }
} 

The message is:

/mnt/code/dbdiadesign/src/unixodbc.vala:65.42-65.66: warning: unhandled error `UnixOdbc.UnixOdbcError'

Where do I put the throws clause in a property declaration?

有帮助吗?

解决方案

You can't throw errors in property getters or setters.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top