It seems odd to me to mix json error code returns on the response with throwing exceptions--you can't really have it both ways.