summaryrefslogtreecommitdiff
path: root/src/dbc
diff options
context:
space:
mode:
authorGilles Dubochet <gilles.dubochet@epfl.ch>2009-05-07 13:31:19 +0000
committerGilles Dubochet <gilles.dubochet@epfl.ch>2009-05-07 13:31:19 +0000
commite9bcc87c818792b47e955152543e31d4ef70d826 (patch)
treee23cf0b930c1a6913339ba79b41eaa5ed998b701 /src/dbc
parent5103735f4b13899421a37091b4e47fd69493e697 (diff)
downloadscala-e9bcc87c818792b47e955152543e31d4ef70d826.tar.gz
scala-e9bcc87c818792b47e955152543e31d4ef70d826.tar.bz2
scala-e9bcc87c818792b47e955152543e31d4ef70d826.zip
DBC: replaced all-encompassing catch with prope...
DBC: replaced all-encompassing catch with proper error-detection logic.
Diffstat (limited to 'src/dbc')
-rw-r--r--src/dbc/scala/dbc/result/Relation.scala9
1 files changed, 7 insertions, 2 deletions
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 <code>None</code> 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, <code>None</code> is returned instead. */