Homec4science

Don't special-case LiskDAO->load(0)

Authored by epriestley <git@epriestley.com> on Jul 16 2012, 18:50.

Description

Don't special-case LiskDAO->load(0)

Summary:
Lisk currently behaves in two different ways if you call it like load("cow") (throws) versus load(99999999) (returns null), where neither ID exists.

This was intended to catch programming errors as distinct from missing data, but in practice the former is very rare and you have to handle the latter in most cases anyway. The case where you pass "0" is particularly confusing. See D2971 for an example.

On the balance, I think this ends up being far more confusing than helpful. Instead, just return NULL if we're sure there's no such object.

Test Plan: Reasoned about program behavior.

Reviewers: alanh, btrahan, vrana

Reviewed By: vrana

CC: aran

Differential Revision: https://secure.phabricator.com/D2977

Details

Committed
epriestley <git@epriestley.com>Jul 16 2012, 18:50
Pushed
aubortJan 31 2017, 17:16
Parents
rPH8fd97f435235: When users submit a no-op edit in Phriction, don't update the document
Branches
Unknown
Tags
Unknown

Event Timeline

epriestley <git@epriestley.com> committed rPHcb8120551f72: Don't special-case LiskDAO->load(0) (authored by epriestley <git@epriestley.com>).Jul 16 2012, 18:50