Lookout: wrap ErrNotFound in GetJobSpec not-found error#4773
Open
mauriceyap wants to merge 1 commit intomasterfrom
Open
Lookout: wrap ErrNotFound in GetJobSpec not-found error#4773mauriceyap wants to merge 1 commit intomasterfrom
mauriceyap wants to merge 1 commit intomasterfrom
Conversation
Contributor
Greptile SummaryThis PR modernises the error handling in
Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[GetJobSpec called] --> B[QueryRow: SELECT job_spec\nWHERE job_id = $1]
B --> C{err != nil?}
C -- No --> D[Decompress rawBytes]
D --> E{decompress err?}
E -- No --> F[proto.Unmarshal]
F --> G{unmarshal err?}
G -- No --> H[Return *api.Job]
G -- Yes --> I[Return unmarshal error]
E -- Yes --> J[Return decompress error]
C -- Yes --> K{errors.Is\nerr, pgx.ErrNoRows?}
K -- Yes --> L["Return nil,\nfmt.Errorf('...not found: %w', ErrNotFound)"]
K -- No --> M[Return nil, err\n other DB error]
Reviews (7): Last reviewed commit: "Lookout: wrap ErrNotFound in GetJobSpec ..." | Re-trigger Greptile |
ac5ab28 to
e0b4388
Compare
JamesMurkin
approved these changes
Mar 20, 2026
Collaborator
Author
|
@Mergifyio refresh |
Contributor
✅ Pull request refreshed |
Collaborator
Author
|
@Mergifyio rebase |
Collaborator
Author
|
@Mergifyio refresh |
Collaborator
Author
|
https://github.com/Mergifyio refresh |
Contributor
✅ Pull request refreshed |
Collaborator
|
https://github.com/Mergifyio refresh |
Contributor
☑️ Command disallowed due to command restrictions in the Mergify configuration.Details
|
Replace github.com/pkg/errors with stdlib fmt.Errorf and wrap ErrNotFound so callers can use errors.Is to distinguish not-found from other errors. Signed-off-by: Maurice Yap <mauriceyap@hotmail.co.uk>
720db59 to
ec4ed20
Compare
Collaborator
Author
|
@Mergifyio refresh |
Contributor
✅ Pull request refreshed |
eleanorpratt
approved these changes
Mar 23, 2026
Collaborator
Author
|
@Mergifyio refresh |
Contributor
✅ Pull request refreshed |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replace github.com/pkg/errors with stdlib fmt.Errorf and wrap ErrNotFound so callers can use errors.Is to distinguish not-found from other errors.