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

Implement automatic error logging for non-successful output. #60

Open
fogfish opened this issue Dec 7, 2024 · 0 comments
Open

Implement automatic error logging for non-successful output. #60

fogfish opened this issue Dec 7, 2024 · 0 comments
Labels
[T] feature the feature, enabler epic or other tech activity

Comments

@fogfish
Copy link
Owner

fogfish commented Dec 7, 2024

	return µ.GET(
		µ.URI(µ.Path("catalog"), µ.Path(lAuthorID), µ.Path("posts"), µ.PathAll(lObjectID)),
		µ.FMap(func(ctx *µ.Context, req *req) error {
			story, err := api.r.Story(ctx,
				core.NewStoryID(profile, string(req.objectID)),
			)
			if err != nil {
				// slog <-- looks redundant here.
				slog.Error("failed to fetch post", "err", err, "uri", ctx.Request.URL)
				return ø.Status.InternalServerError(
					ø.Error(err, "failed to fetch post"),
				)
			}
       ...

Embed slog within InternalServerError, each output needs to accept ctx.

@fogfish fogfish added the [T] feature the feature, enabler epic or other tech activity label Dec 7, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[T] feature the feature, enabler epic or other tech activity
Projects
None yet
Development

No branches or pull requests

1 participant