Adding onPhotoUpload plugin action. Extending the error response to take the message and code from the exception. Closes #529 Closes #556