faas-cli
faas-cli copied to clipboard
Provide better error handling for SDK error
Provide a better way to check for the errors returned by SDK function.
Expected Behaviour
Create custom error package with types/methods for different errors returned by SDK, which will allows users to check for specific errors as below
errors.IsSuchandsuch(err)
Current Behaviour
Right now these checks can be performed using string matching with error messages
Possible Solution
Steps to Reproduce (for bugs)
Context
Your Environment
-
FaaS-CLI version ( Full output from:
faas-cli version
): -
Docker version ( Full output from:
docker version
): -
Are you using Docker Swarm (FaaS-swarm ) or Kubernetes (FaaS-netes)?
-
Operating System and version (e.g. Linux, Windows, MacOS):
-
Link to your project or a code example to reproduce issue:
Derek assign: me
@viveksyngh do you have an update on this?
@viveksyngh just checking in again now, as it's been quite a few months since this came up on the radar for you to work on. I also asked several months ago what your update was.
Please can you take time to answer and keep us in the loop? Do you want someone else to take this?
I will un-assign it and let it be open for someone else to take it. I will try to complete my current tasks and then comeback to this one.
Ok, would you mind detailing a solution so that someone else could pick it up later?
@alexellis I would like to work on this
We need to discuss how we want to add different error types like auth error, build error, connection error etc. And can add different functions like:
type Error struct {
Msg error `json:"err_msg"`
}
func (e Error) AuthenticationError() error {
return fmt.Errorf("authentication error: %s", e.Msg)
}
for each.
Please give your thoughts.
Hi @NikhilSharmaWe for the time being we've worked around this and created a separate Go SDK:
https://github.com/openfaas/go-sdk
There are some additional methods we could add - perhaps check out the Swagger and suggest on this issue what's missing or could be added?
https://github.com/openfaas/faas/blob/master/api-docs/swagger.yml
The Swagger also wasn't updated for namespaces support in OpenFaaS for Enterprises, so that could be something you could add to the Swagger in a separate PR - including the list namespaces endpoint.
Alex