Skip to content

Commit 1b82cb8

Browse files
authored
surface any errors encountered during schema validation (#672)
1 parent e326a9b commit 1b82cb8

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

pkg/course/course.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,7 @@ func OpenCourseFile(fileName string, schema []byte) (*FileV2, error) {
338338

339339
if err := courseFile.validateJsonSchema(schema); err != nil {
340340
klog.V(3).Infof("failed to validate jsonSchema in course file: %s", fileName)
341-
return nil, SchemaValidationError
341+
return nil, err
342342
}
343343

344344
return courseFile, nil
@@ -562,12 +562,12 @@ func (f *FileV2) validateJsonSchema(schemaData []byte) error {
562562

563563
jsonData, err := json.Marshal(f)
564564
if err != nil {
565-
return SchemaValidationError
565+
return err
566566
}
567567

568568
result, err := schema.Validate(gojsonschema.NewBytesLoader(jsonData))
569569
if err != nil {
570-
return SchemaValidationError
570+
return err
571571
}
572572
if len(result.Errors()) > 0 {
573573
for _, err := range result.Errors() {

0 commit comments

Comments
 (0)