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

Propose, Error response details ? #42

Open
raditzlawliet opened this issue Jul 15, 2020 · 1 comment
Open

Propose, Error response details ? #42

raditzlawliet opened this issue Jul 15, 2020 · 1 comment
Labels
enhancement New feature or request

Comments

@raditzlawliet
Copy link

I'm trying to use xendit-go with simple code like below

	data := invoice.CreateParams{
		ExternalID:      sop.ID,
		Amount:          sop.TotalAmount,
		PayerEmail:      sop.AccountID,
		Description:     fmt.Sprintf("Invoice #%s", sop.ID),
		InvoiceDuration: int(expiredAt.Sub(time.Now()).Seconds()),
	}
	resp, e := invoice.Create(&data)
	if e != nil {
		return e
	}

and only getting response API_VALIDATION_ERROR with There was an error with the format submitted to the server. without any clue.
but when using curl or postman it show more detail

{
    "error_code": "API_VALIDATION_ERROR",
    "message": "There was an error with the format submitted to the server.",
    "errors": [
        {
            "field": [
                "invoice_duration"
            ],
            "location": "body",
            "messages": [
                "\"invoice_duration\" must be greater than 0"
            ],
            "types": [
                "number.greater"
            ]
        }
    ]
}

It will good if we also got error details in response. it will saving more time for debugging what's wrong with it

@stanleynguyen stanleynguyen added the enhancement New feature or request label Jul 15, 2020
@stanleynguyen
Copy link
Contributor

Hi @raditzlawliet. Thanks for your feedback.
Yes we have error standardisation in plan for our API, afterwards, our errors will come with more details definitely.
Stay tuned!

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

No branches or pull requests

2 participants