-- Eric
Nat
Besides maybe the .find(id, ...) call, most operations in Jester should
expect the possibility of failure. If user-entered data is invalid, so
a save() call fails, that shouldn't be treated as an exception, only as
a failed save.
-- Eric
Alternatively, what about doing this the way ActiveRecord does it -
i.e. on failure, return a datamodel object with a .errors attribute,
containing the error messages? Possibly also a .transport attribute
for debugging purposes, if that would be useful.
Nat
post = Post.find(1)
post.email = "invalid email"
post.save()
You can now access post.errors. In the case of an asynchronous
callback, I think it just passes in "true" or "false", which may not be
ideal, but in either case the errors are there.
But this started about how to deal with a failed .find call, where there
would be no model errors, and how to handle that on failure. I like
returning the transport, since that's the only remaining artifact from a
failed find(), but I'm open to other suggestions.
-- Eric
But, there's no reason that can't move from the 2nd to the 3rd slot -
it'd break backwards compatibility, but I'm thinking it'll be okay.
-- Eric