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

Provide better error handling for SDK error #794

Open
viveksyngh opened this issue Apr 11, 2020 · 7 comments
Open

Provide better error handling for SDK error #794

viveksyngh opened this issue Apr 11, 2020 · 7 comments

Comments

@viveksyngh
Copy link
Contributor

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:

@viveksyngh
Copy link
Contributor Author

Derek assign: me

@alexellis
Copy link
Member

@viveksyngh do you have an update on this?

@alexellis
Copy link
Member

@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?

@viveksyngh
Copy link
Contributor Author

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.

@viveksyngh viveksyngh removed their assignment Oct 11, 2020
@alexellis
Copy link
Member

Ok, would you mind detailing a solution so that someone else could pick it up later?

@NikhilSharmaWe
Copy link
Contributor

@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.

@alexellis
Copy link
Member

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants