From e9bcc87c818792b47e955152543e31d4ef70d826 Mon Sep 17 00:00:00 2001 From: Gilles Dubochet Date: Thu, 7 May 2009 13:31:19 +0000 Subject: DBC: replaced all-encompassing catch with prope... DBC: replaced all-encompassing catch with proper error-detection logic. --- src/dbc/scala/dbc/result/Relation.scala | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/dbc') diff --git a/src/dbc/scala/dbc/result/Relation.scala b/src/dbc/scala/dbc/result/Relation.scala index 67a8e51cc3..63881daff7 100644 --- a/src/dbc/scala/dbc/result/Relation.scala +++ b/src/dbc/scala/dbc/result/Relation.scala @@ -39,8 +39,13 @@ abstract class Relation extends AnyRef with Iterable[Tuple] { /** Metadata about the field at the given index. If there is no such * field None is returned instead. */ - def metadataFor (index:Int): Option[FieldMetadata] = - try {Some(metadata(index))} catch {case e => None} + def metadataFor (index:Int): Option[FieldMetadata] = { + val meta = metadata + if (meta.length > index) + Some(meta(index)) + else + None + } /** Metadata about the field with the given column name. If there is no * such field, None is returned instead. */ -- cgit v1.2.3