コード例 #1
0
ファイル: schema_validator.py プロジェクト: kyle-long/pyshelf
    def validate(self, schema_path, data):
        """
            Validates data against schema. Logs and reraises any exceptions that occur.

            Args:
                schema_path(string)
                data(type outlined schema)

            Raises:
                jsonschema.ValidationError: if data does not match schema
                IOError: if schema_path is invalid
                jsonschema.SchemaError: if schema is flawed
        """
        try:
            utils.validate_against_schema(schema_path, data)
        except Exception as e:
            self.logger.exception(e)
            # Log then reraise exception
            raise