Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Genbank parser rewrite #437

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
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
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
Loading