GitbeakerRequestError.cause.description
has wrong type
#3646
Labels
type:bug
Changes fix a minor bug
GitbeakerRequestError.cause.description
has wrong type
#3646
Description
22.8.0
40.6.0
the
GitbeakerRequestError
object has a propertycause.description
which is defined inGitbeakerError.ts:4
as a string, however at runtime this value contains an object.Steps to reproduce
Run the following code snippet (replacing the token and project ID values with any project you have access to).
Expected behaviour
The program should print out
Actual behaviour
The program will output
Possible fixes
I believe that the issue is caused by the handling of the
description
field inRequester.ts
. The issue could probably be fixed by checking the type of themessage
field and changing the resolution behavior based on its value.Gitlab's error message formatting is somewhat inconsistent and not always included in the API documentation so it might be the case that there isn't a guaranteed way to get the core error message, but it might be enough to simply check the type of the
message
field and if it is not a string, return a JSON stringified version of the response object.Checklist
The text was updated successfully, but these errors were encountered: