Bug Fix #2: Nonsense Error Message When Saving Profile

Today I received feedback that a provider was receiving an error message when attempting to save the company profile. The error looked like this:

Fatal error: Uncaught PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘Provider Name’ for key ‘name’ in /var/www/pas/lib/vendor/propel/propel/src/Propel/Runtime/Connection/StatementWrapper.php:194
Stack trace:
#0 /var/www/pas/lib/vendor/propel/propel/src/Propel/Runtime/Connection/StatementWrapper.php(194): PDOStatement->execute(NULL)
#1 /var/www/pas/lib/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/Criteria.php(2451): Propel\Runtime\Connection\StatementWrapper->execute()
#2 /var/www/pas/lib/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/ModelCriteria.php(1722): Propel\Runtime\ActiveQuery\Criteria->doUpdate(Object(Propel\Runtime\ActiveQuery\Criteria), Object(Propel\Runtime\Connection\ConnectionWrapper))
#3 /var/www/pas/lib/propel/Base/Provider.php(1419): Propel\Runtime\ActiveQuery\ModelCriteria->doUpdate(Object(Propel\Runtime\ActiveQuery\Criteria), Object(Propel\Runtime\Connection\ConnectionWrapper))
#4 /var/www/pas/lib/propel/Base/Provider.php(1233): Base\Provider->doUpdate(O in /var/www/pas/lib/vendor/propel/propel/src/Propel/Runtime/ActiveQuery/Criteria.php on line 2462


Really, though, the error boils down to:

Duplicate entry ‘Provider Name’ for key ‘name’

This is saying that the provider name which was entered already belongs to another provider (duplicate). The point is to prevent confusion by forcing providers to use unique names. This helps users recognize the difference between providers. The real problem here is the confusion the error message causes, so I have updated the system to “catch” the error and return a readable error like the one in the picture.

This can sometimes happen when a provider signs up with multiple E-mail addresses. You may not have liked the E-mail address you used first, or you forgot which one you used, or someone else at your organization signed up. In any case, each unique E-mail address creates a unique account. For instance, if I create a provider using “zeal@egrobotics.com”, and I fill in my provider name “EG Robotics”, then someone else creates an account using “egr@egrobotics.com” and tries to fill in their provider name as “EG Robotics”, this will cause an error.

The solution, in that case, is to log in with the E-mail address you do not prefer, and change your provider name to something random that does not conflict. Then you can log in with your preferred address and use your preferred provider name. If you were able to log in and set your provider name, then you received a confirmation E-mail at the address you provided, so you can search your E-mail inboxes for that confirmation if you forgot which E-mail address was used before.