getlago / lago-go-client

Lago Go Client
MIT License
21 stars 19 forks source link

fix: API error Unmarshaling #108

Closed vincent-pochet closed 1 year ago

vincent-pochet commented 1 year ago

Context

Current Error struct does not match format of the API sent by the API

The API format is:

{
  "status": 422, 
  "error": "Unprocessable Entity",
  "code": "validation_errors", 
  "error_details": {
    "code": ["value_already_exist"]
  }
}

while the current implementation is expecting:

{
  "status": 422, 
  "message": "Unprocessable Entity",
  "error_details": ["value_already_exist"]
}

Description

This PR updates the struct tags to ensure error received from the API are correctly parsed

vincent-pochet commented 1 year ago

Related to https://github.com/getlago/lago-go-client/issues/92