Skip to content

Releases: webrpc/gen-golang

v0.14.7: Add .WithCausef() shorthand for defining error cause

23 Apr 14:15
badb0e7
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.14.5...v0.14.7

Supersedes v0.14.6, which contained a syntax error.

v0.14.6: Add .WithCausef() shorthand for defining error cause

23 Apr 13:46
66c95b9
Compare
Choose a tag to compare

v0.14.5

17 Apr 17:15
fc75708
Compare
Choose a tag to compare
  • Removes unused JSON decoder

v0.14.4

17 Apr 17:08
Compare
Choose a tag to compare
  • Fixes Go client webrpc streaming hanging under certain cirmustances #63, thanks to @xiam

v0.14.2: Expose as Go module

04 Apr 14:58
Compare
Choose a tag to compare
Expose as Go module with //go:embed FS

v0.14.1

12 Mar 16:52
Compare
Choose a tag to compare

Fixes context propagation to HTTP requests.

v0.14.0

11 Mar 13:00
3f1f017
Compare
Choose a tag to compare

What's Changed

New Contributors

  • @alinz made their first contribution in #54

Full Changelog: v0.13.7...v0.14.0

v0.13.7: Introduce .Is() method on enums

28 Nov 11:11
d244bd7
Compare
Choose a tag to compare

v0.13.5: Add missing reflect import when -fixEmptyArrays is used

02 Nov 10:15
508b1fc
Compare
Choose a tag to compare
  • Add missing reflect import when -fixEmptyArrays is used

v0.13.4: Implement server OnError() hook

28 Sep 17:18
979bdb8
Compare
Choose a tag to compare
  • Implement server OnError() hook (#46)

Example:

rpcServer := proto.NewVideoServer(app.Rpc)

rpcServer.OnError = func(r *http.Request, err *proto.WebRPCError) {
	ctx := r.Context()

	// Log error with request log
	httplog.LogEntrySetField(ctx context.Context, "webrpcError", err.Error())

	// Report crucial DB errors to Sentry
	var pgErr *pgconn.PgError
	if errors.As(err, &pgErr) {
		// https://www.postgresql.org/docs/16/errcodes-appendix.html
		if strings.HasPrefix(pgErr.Code, "42") {
			sentry.CaptureException(err)
		}
	}

	// Add requestID to error message itself.
	rpcErr.Message = fmt.Sprintf("%s (requestID: %v)", rpcErr.Message, middleware.GetReqID(ctx))

	// Hide error details from users in production.
	if app.Config.Environment.IsProduction() {
		rpcErr.Cause = ""
	}
}