Testing for a specific error message seems fragile. But the alternative (returning a JSON response object indicating success or failure, with details) comes down to the same thing -- both sides must agree on an interface and both sides need to change if the interface changes. This is simpler, and time is short...