-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Resolves #26 - Make a distinction between parsing and validation erro…
…rs. (#49) * add parsing and validation error types (#29) * Tweaks for error messaging and comments * Resolves #26 - Improves error handling so that consumers can return 400 and not 500 on unrecognized operators --------- Co-authored-by: Carl Markham <[email protected]>
- Loading branch information
1 parent
7909df8
commit 64f8175
Showing
7 changed files
with
103 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
package epsearchast_v3 | ||
|
||
import "fmt" | ||
|
||
type ParsingErr struct { | ||
err error | ||
} | ||
|
||
func (pe ParsingErr) Error() string { | ||
return pe.err.Error() | ||
} | ||
|
||
func NewParsingErr(err error) ParsingErr { | ||
return ParsingErr{ | ||
err: fmt.Errorf("could not parse filter: %w", err), | ||
} | ||
} | ||
|
||
type ValidationErr struct { | ||
err error | ||
} | ||
|
||
func (ve ValidationErr) Error() string { | ||
return ve.err.Error() | ||
} | ||
|
||
func NewValidationErr(err error) ValidationErr { | ||
return ValidationErr{ | ||
err: fmt.Errorf("error validating filter: %w", err), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters