@recaptime-dev's working patches + fork for Phorge, a community fork of Phabricator. (Upstream dev and stable branches are at upstream/main and upstream/stable respectively.) hq.recaptime.dev/wiki/Phorge
phorge phabricator
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Make nonscalar field saves raise a more useful exception from LiskDAO

Summary:
If you do something like this:

// Missing $user->getPHID()!
$object->setUserPHID($user)->save();

...you get a very unhelpful exception:

Expected a scalar or null for %s conversion. Query: %s

This doesn't give you any hints about what's wrong. Instead, provide a more useful exception:

Unable to insert or update object of class DifferentialRevision, field 'title' has a nonscalar value.

Test Plan: {F87614}

Reviewers: hach-que, btrahan

Reviewed By: btrahan

CC: aran

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

+11 -1
+11 -1
src/infrastructure/storage/lisk/LiskDAO.php
··· 1244 1244 $columns = array_keys($data); 1245 1245 1246 1246 foreach ($data as $key => $value) { 1247 - $data[$key] = qsprintf($conn, '%ns', $value); 1247 + try { 1248 + $data[$key] = qsprintf($conn, '%ns', $value); 1249 + } catch (AphrontQueryParameterException $parameter_exception) { 1250 + throw new PhutilProxyException( 1251 + pht( 1252 + "Unable to insert or update object of class %s, field '%s' ". 1253 + "has a nonscalar value.", 1254 + get_class($this), 1255 + $key), 1256 + $parameter_exception); 1257 + } 1248 1258 } 1249 1259 $data = implode(', ', $data); 1250 1260