Just observed that when throwing Exceptions, the step definitions use different syntax. Example:
throw new \Exception(sprintf('No such Drupal string: %s', $name));
throw new \Exception('No submit button at ' . $this->getSession()->getCurrentUrl());
throw new \Exception("Failed to log in as user \"{$this->user->name}\" with role \"{$this->user->role}\".");
throw new \Exception("No link to " . $link . " on " . $this->getSession()->getCurrentUrl());
throw new \Exception("$region region was not found");
Can anyone please suggest which one of the above is the preferable one?
Comments
Comment #1
jhedstromI prefer
sprintf('No such Drupal string: %s', $nameas they tend to be more readable.Comment #2
eliza411 commentedI know this question is about the syntax, but on a content level, I'd like to add that I really appreciate inclusion of the current URL wherever it's appropriate.
Comment #3
kssundar commentedAttached is the patch that changes all exception messages to sprintf format as in #1
Comment #4
jhedstromCommitted #3 in 56eee8f. Thanks!