Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions io/pdbx/cif/doc.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
/*
Package cif provides utilities to read and write CIF v1.1 files.

See https://www.iucr.org/resources/cif/spec/version1.1 for a full
description of the CIF v1.1 syntax.
*/
package cif
22 changes: 22 additions & 0 deletions io/pdbx/cif/errors.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package cif

import "fmt"

// A CIFSyntaxError is a syntax error produced while parsing a CIF file.
type CIFSyntaxError struct {
Line int
Msg string
}

// Wrap creates a new CIFSyntaxError wrapped with msg.
func (s CIFSyntaxError) Wrap(format string, a ...any) error {
return CIFSyntaxError{
Line: s.Line,
Msg: fmt.Sprintf("%s: %s", fmt.Sprintf(format, a...), s.Msg),
}
}

// Error returns the formatted error message.
func (s CIFSyntaxError) Error() string {
return fmt.Sprintf("CIF syntax error at line %v: %s", s.Line, s.Msg)
}
Loading