Skip to content

Commit

Permalink
Beginning of rewrite. Can parse header and LOCUS.
Browse files Browse the repository at this point in the history
  • Loading branch information
carreter committed Jan 11, 2024
1 parent efd4540 commit 893224f
Show file tree
Hide file tree
Showing 7 changed files with 729 additions and 2,000 deletions.
27 changes: 27 additions & 0 deletions io/genbank/error.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
package genbank

import "fmt"

// A GenbankSyntaxError denotes a sytntax error in
// a Genbank flatfile.
type GenbankSyntaxError struct {
Line uint
Context string
Msg string
InnerErr error
}

// Error returns a human-readable error message.
func (gse GenbankSyntaxError) Error() string {
msg := gse.Msg
if gse.InnerErr != nil {
msg = fmt.Errorf("%v: %w", msg, gse.InnerErr).Error()
}

return fmt.Sprintf("syntax error at line %v: %v\n%v\t%v", gse.Line, msg, gse.Line, gse.Context)
}

// Unwrap returns any errors underlying the syntax error, if applicable.
func (gse GenbankSyntaxError) Unwrap() error {
return gse.InnerErr
}
168 changes: 0 additions & 168 deletions io/genbank/example_test.go

This file was deleted.

Loading

0 comments on commit 893224f

Please sign in to comment.