Update docstring/comment re: raising default

This commit is contained in:
Chad Whitacre
2016-11-21 19:41:51 -05:00
parent 7588c1ca2b
commit 3b7438f130
+4 -2
View File
@@ -201,9 +201,11 @@ class RecordCollection(object):
return self.all(as_dict=not(ordered), as_ordereddict=ordered)
def first(self, default=None, as_dict=False, as_ordereddict=False):
"""Returns a single record for the RecordCollection, or `default`."""
"""Returns a single record for the RecordCollection, or `default`. If
`default` is an instance or subclass of Exception, then raise it
instead of returning it."""
# Try to get a record, or return default.
# Try to get a record, or return/raise default.
try:
record = self[0]
except IndexError: