public static function validateData($data)
    {
        // @todo Prior code also checked for $data being an array, but the docs
        // at https://docs.theplatform.com/help/wsf-handling-data-service-exceptions#tp-toc4
        // don't show that.
        $required = [
            'responseCode',
            'isException',
            'title',
        ];

        // The error description is only returned for client errors. According
        // to thePlatform support, the documentation is wrong about description
        // always being included.
        if (isset($data['responseCode']) && $data['responseCode'] >= 400 && $data['responseCode'] < 500) {
            $required[] = 'description';
        }

        foreach ($required as $key) {
            if (empty($data[$key])) {
                throw new \InvalidArgumentException(sprintf('Required key %s is missing.', $key));
            }
        }
    }