Skip to content

[post] Error handling in go, rust, java, cpp and gRPC #57

@at15

Description

@at15

Type

  • request post from @at15

Related

Description

NOTE: The draft is in go/pl/doc/error.md

You can't avoid error handling in any programming language (like you can't avoid death and IRS).
Although the philosophy and runtime implementation are different (error value, result, exception), there are still many things in common (e.g. wrap, unwrap, multiple errors, custom error type, error in a different thread).

Furthermore, when it comes to a cloud native (or k8s native) micro service architecture, you need to pass error across the wire.
Clearly http status code can't meet the complexity of your highly available, multi (hybrid) cloud, global scale, low latency, high throughput, custom json to yaml converter. A well defined interface error format is needed, it can be generated from different programming languages, serialized and passed through different rpc frameworks (json, gRPC) and shows the trace across different services, libraries and functions.

The post plans to cover the following

  • all the languages
    • error wrapping, context, recovery
    • common errors (in runtime/stdlib)
    • common error libraries
  • go
    • the most basic Error() string
    • the newer go error interface proposal and implementation, errors.Is, fmt.Errof("%w") etc.
    • go error libraries in popular projects (k8s, tidb etc.)
  • rust
    • the ?
  • java
  • different java exceptions (I remember there two kinds, you need to write throws for one of them)
  • cpp
    • the overhead of exception in cpp
  • os
    • cpu exception
    • syscall error
    • kernel error (from user and kernel itself)
  • rpc
    • http status code
    • grpc
      • define detail error instead of just using builtin errors
    • serialize error
    • trace error
    • error collecting services, e.g. Sentry

Update

  • 2020-08-07 20:01 Init

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions