Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

>it returns an error with string representation: "open cred.json: no such file or directory". This comes straight from the std lib as it is, a great error.

It’s a terrible error. It’s not structured, so you can’t aggregate it effectively in logs, on top of that it leaks potential secret, so you can’t return it from RPC handler.



The string representation is obviously not structured, because it's a string representation and strings are scalars. The typed representation is structured, which you can put into your structured logs as you'd like, omitting sensitive information where needed.


The "typed" representation is an `error` type that a million other methods use with a single method that returns the string:

    type error interface {
      Error() string
    }
It's the same unstructured goslop.


This error is backed by a strict with error codes and so on.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: